Craft

A GUI Manager for Docker on Linux

Docker is a prominent container technology widely used by system administrators and IT engineers. It’s a great tool for quickly setting up complex IT environments and deploying software systems securely.


Docker comes with a robust CLI tool to get the job done, but sometimes you might think of having a graphical view of Docker containers and their related services, which the Docker CLI does not provide. That’s where Portainer comes in.


What Is Portainer?

Portainer is a GUI tool to easily manage containers in Docker, Docker Swarm, Azure ACI, and Kubernetes, be it on-prem or in the cloud.

Portainer is itself deployed as a Docker image and is very lightweight. It’s made up of two core elements: the Portainer server and the Portainer agent. The agent communicates with the server to provide access to the node’s resources.

You can install Portainer on Linux or Windows, and it even supports installation on Windows Subsystem for Linux (WSL). Under the hood, Portainer utilizes the Docker CLI to offer you a good level of abstraction.

Installing Portainer on Linux

As mentioned earlier, Portainer is installed as a Docker image, so you’ll need to have Docker up and running on your machine. If you do not have it installed, here’s how to install Docker on Ubuntu.

You can either install the commercial version of Portainer, which comes with some extra benefits such as service support, or simply use the Community Edition.

Start by creating a Docker volume that will host the Portainer database and its associated data using the following command:

docker volume create portainer_data

Next, run the Portainer Docker image. If it is not available locally, Docker will automatically download it from the Docker Hub.

docker run -d -p 8000:8000 -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

The aforementioned command uses the HTTP port 9000 for legacy support, but you can also use the 9443 HTTPS port, and Portainer will install a self-signed SSL certificate. You can also use your own certificates if you wish to.

When the image has finished downloading, you can check whether it is up and running using the following command:

sudo docker ps

Your Portainer container should be listed in the output along with any other containers that you have.

Overview of Portainer

To access the Portainer dashboard, go to the default Portainer URL, which is http://localhost:9000 in your web browser.

The default username is admin and you’ll need to enter a secure password to continue. These will be your login details going forward. You can also change the username if you wish to.

When you first log in, Portainer will ask you to configure your environment. Select the Get Started option which uses the local environment on which Portainer is running. You can add more environments to manage Docker containers from other remote PCs or servers.

The left menu bar shows an overview of important components such as the Dashboard tab, Images tab, Networks, Stacks, Users, Environments, etc.

Managing Docker Containers Using Portainer

Managing containers and images from the Portainer menu is quite easy. Simply select the component that you want to configure in your Docker environment and then modify it to your liking.

Most of the components are self-explanatory. Here are some of the most important ones:

1. Dashboard

The Dashboard page gives you a quick glance at your operational environment with important statistics. You can click on each of the components in the dashboard to get more info regarding a specific component.

You can easily get a summary of how much disk space your containers are consuming and which ones are healthy or not. You can also get a good overview of network interfaces and IP addresses of your Docker containers.

Apart from the Docker information, you can also get PC RAM capacity. You won’t find any Docker command that gives you such a comprehensive summary within a single page. And this is where Portainer shines.

2. Images

You can use the Images tab to pull new images into your Docker environment. By default, Portainer uses Docker Hub to get Docker images. Search for images by entering the name of the image you are looking for and then click the Search button to look for it in Docker Hub.

To pull a new image, enter the name including the tag as it appears in Docker Hub, and click on the Pull the image button.

The Images page lists all images in your environment, including their size, tags, and the date the image was created. You can also build new Docker images from this page.

3. Containers

The Docker container page is a great place to get an overview of all containers in your environment. Here you’re presented with an overview of both running and inactive containers.

You can also spin up new Docker containers from the images that are available locally on your PC or those that are in Docker Hub.

To run a container, simply click on the Add container button. Then, provide the details of the container such as name, tag, whether you want to use a shell, interactive and TTY, etc. The parameters you provide here are similar to what you would provide when using the docker run command.

4. Other Components

Some other important components in Portainer include:

  1. Stacks: Stacks give you the option to define Docker Compose files. You can either specify the Docker Compose files within the Portainer editor window or upload them from your PC. You can even pull your Docker Compose files directly from GitHub.
  2. Networks: The Networks tab lists all the network interfaces in use by the different Docker images in your environment. IP addresses and network types are also displayed on this page. And of course, you can add new networks to your environment.
  3. Volumes: Volumes simplify data management in Docker containers. Volumes allow you to host your Docker container data on the host PC, which is great because it makes the management of Docker images easier. The Volumes page allows you to easily create new volumes and administer existing ones.
  4. Users: Initially, we created an admin user for Portainer, but in case you want to add more users to manage your environment and have different access levels then this is the place.

Docker and Portainer Are Awesome When Combined!

Portainer is a very lightweight GUI manager for Docker. It is very easy to set up, and you can use it to manage multiple Docker environments either on your local PC or on remote servers.

[quads id=2]
Read the full article here

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button