Portainer is a lightweight, cross-platform, and open source management UI for Docker. Portainer provides a detailed overview of Docker and allows you to manage containers, images, networks and volumes via simple web-based dashboard. It was originally the fork of Docker UI. However, the developer has rewritten pretty much all of the Docker UI original code now. He also has revamped the UX completely and added some more functionality in the recent version. As of now, It caught the user attention tremendously and it has now had over 1 million downloads and counting! It will support GNU/Linux, Microsoft Windows, and Mac OS X.
In this tutorial, I will show you how to install Portainer and how to manage docker containers using Portainer in Linux.
Manage Docker Using Portainer
Portainer installation is pretty easy and it will take less than a minute. Portainer has full support for Docker version 1.10 and higher versions. To install Docker, refer the following links.
After installing Docker, run the following command to pull the latest Portainer image:
$ sudo docker pull portainer/portainer
Using default tag: latest latest: Pulling from portainer/portainer a3ed95caeb02: Pull complete 802d894958a2: Pull complete 045765bf2706: Pull complete Digest: sha256:495cb906c964f746f955b6d03c6235d80e48e1a46773a24b1764c95f03f15079 Status: Downloaded newer image for portainer/portainer:latest
Let us check whether the Portainer image has been pulled or not.
$ sudo docker images
portainer/portainer latest ec91653336d4 7 days ago 9.132 MB
As you see in the above output, Portainer image size is less than 10 MB, which is very small so that I won't consume more RAM and Hdd space.
We have now installed Portainer in our local Ubuntu system. Let us start the container using command:
$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
Now, Portainer is running! Let us go ahead and access the Portainer UI. To do so, open your wbe browser and point it to - http://localhost:9000/ or http://IP_Address:9000/. You will be presented with a screen like below that asks to setup a password for the admin user.
Enter the password twice and hit Validate button to create the admin user password.
In the next screen, enter the admin user which you just created in the previous step.
Next, Connect Portainer to a Docker engine or Swarm cluster endpoint. We don't have any running remote docker instances. So I chose "Manage the Docker instance where Portainer is running" option.
Once connected, you will be pleased with Portainer dashboard like below.
The dashboard home screen displays the running and stopped containers, number of downloaded docker images, number of volumes and networks. You don't have memorize docker commands. Everything can be done from the Dashboard itself.
Let us go ahead and create some containers.
Click on the App Templates button on the left. This will show some ready-made available templates such as Docker image registry, Nginx, Httpd, MySQl, WordPress and few more.
To deploy a Container, just click on the respective template.
Let us launch MySQL Container. To do so, click on the MySQL template. Enter the Container name, select network type (ex.bride mode). click on Show advanced options and set port number.
Finally, Click Create.
Once the container created, you will be redirected to the Containers page that shows the list of running containers.
To start a newly created container, just select it and hit Start button on the top. You can restart, stop, pause, and remove any Containers from this section.
To view the complete overview of any container, just click on the name of the container.
Click on the Stats button to view what's happening in the newly launched Container.
Here is the Stats of my Database container.
Similarly, click on the Logs button to view complete log details of the Container.
Another notable feature is you can easily connect to the console of your Container by clicking on the Console button.
Select the Shell (BASH or SH), and hit Connect button.
In this section, you can view the list of downloaded docker images.
To remove any image, just select it and click Remove. The selected image will be gone.
Networks section allows you to add a new network, change the network type, assign/change IP address, remove existing networks.
Here you can view existing docker volumes, create new one, delete them if you no longer need them.
Here we can view what we have been doing so far, such as creating a new instance, network, volume etc.
This section displays the Docker engine version, Host OS name, type, architecture, cpu, memory, network details etc.
In a nutshell, using Portainer, you can do complete docker management either from the local system itself or a remote system. As far as I tested, it worked pretty good for me. I don't even get single issue while testing it. If you want a feature rich, yet simple to use centralized Docker management solution, you should give Portainer a try. It worked perfectly as advertised in its official website.
- Getting Started With Docker
- How To Automatically Update Running Docker Containers
- ctop – A Commandline Monitoring Tool For Linux Containers
- Dockly - Manage Docker Containers From Terminal
- PiCluster – A Simple, Web-based Docker Management Application
For more details, check the official site. Any thoughts about Portainer? Have you already tried it? Great! Let us know them in the comment section below.