How to Manage Docker Containers using Portainer on Ubuntu

Portainer is an open-source management UI for Docker, including Docker Swarm environment. Portainer makes it easier for you to manage your Docker containers, it allows you to manage containers, images, networks, and volumes from the web-based Portainer dashboard.

In this tutorial, I will show you step-by-step how to install and configure Portainer on Ubuntu 16.04 LTS. We will install and configure Portainer, deploy the Apps Container, Manage Container, images, network, and volumes for our Docker environment.

Prerequisites

  • Ubuntu Server 16.04
  • Root privileges

What we will do

  1. Install Docker on Ubuntu 16.04
  2. Install and Configure Portainer
  3. Deploy Ghost Blog App Container
  4. Docker Environment Management

Step 1 - Install Docker on Ubuntu 16.04 LTS

Before installing docker packages, please update the repository on your system and upgrade packages.

sudo apt update
sudo apt upgrade

Now install docker using the apt command below.

sudo apt install docker.io -y

After the installation is complete, start docker service and enable it to launch everytime at system boot.

systemctl start docker
systemctl enable docker

Docker installed on ubuntu 16.04 server, check it using the command below.

docker version

And you will get the docker version 1.x installed on the system.

Install Docker on Ubuntu

Step 2 - Install and Configure Portainer

Portainer can be installed as a docker container and standalone without docker container.

In this tutorial, we will install Portainer as a Docker container. It's really simple to install and run on any system because we just need to ensure the system support for Docker.

Before installing Portainer, download the Portainer image from the DockerHub using the docker pull command below.

docker pull portainer/portainer

Install Portainer

Now run Portainer using the simple docker command below.

docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

Portainer is now running as a container, check it using the docker ps command.

docker ps

And you will get the result as below.

Docker ps result

Portainer is now running as a Docker container with the name 'elatted_hopper', and it's running under port 9000.

Next, we will configure the Admin password for the Portainer.

Open your web browser and type the server IP address with port 9000.

http://192.168.33.10:9000/

You will get the page about the admin user and password configuration.

Portainer UI

Type your strong admin password and click the 'Create user' button.

Now we need to define which environment Portainer will connect. Portainer offers support for standalone Docker environment, Docker Swarm, and Swarm mode.

For this guide, we will configure Portainer to connect to the local Docker environment.

Connect Portainer to Docker

Choose the 'Local' environment and click 'Connect' button.

And now you will see the Portainer Admin Dashboard.

Portainer Admin dashboard

Portainer has been installed as a Docker Container on Ubuntu 16.04.

Step 3 - Deploy New App Container

After the Portianer installation, we will run the Application Container using Portainer.

Click the 'App Template' menu.

Now choose the application that you want to install. For this guide, we will install the 'Ghost' blog as a Docker Container.

Deploy app container

Click 'Ghost'.

Type the container name 'ghost-blog' and click the 'Show advanced options'. On the 'Port mapping' configuration, type port 80 on the 'host'.

Create container for Ghost Blog

Now click 'Deploy the container' button.

And when it's complete, you will get the container page as below.

Container details

Ghost is now installed as a Docker Container and it's using port 80 on the host.

Open your web browser and type the server IP address.

http://192.168.33.10/

And you will get the 'Ghost' blog homepage as below.

Container deployed successfully

Step 4 - Manage Docker Environment Using Portainer

In this step, we will configure Docker Environments such as Docker images, Container, Volumes, and Networks.

Manage Containers

Portainer provides a simple and easy way to use management for Docker Containers.

Click the 'Containers' menu on the left and you will get the page as below.

Manage containers with Portainer

We can start, stop, restart, create a new container, access the shell of the container, see the container log, and stats of the container from this Portainer container management.

Shell of the Ghost container:

Access shell of the container

Ghost container logs:

Log files of the container

The container stats:

Statistics of the Docker container

Manage Docker Images

Click the 'Images' menu and you will get the page as below.

Manage Docker images

Now we can see the list of docker images on our system, and we can create manually a new docker image, or pull/download new images from the DockerHub repository.

Manage Networks

From this menu, we create new custom networks for our Docker environment. Click the 'Networks' menu.

Manage network settings for Docker Containers

Manage Volumes

This menu provides an easy way to create new custom volumes for our container.

We just need to create new custom volumes, and when we want to create new container the application, just attach it to the container through the 'Advanced options' menu.

Manage Docker Volumes

Installation and configuration of the Portainer Docker Management UI on Ubuntu 16.04 has been completed successfully.

Reference

Share this page:

8 Comment(s)