Portainer: Using a front-end to Manage Docker

Reviewing Portainer: A Frontend for Docker

Managing your Dockers from command-line can be cumbersome. It may also make it more difficult to pass the day-to-day admin work onto someone else. Learn how to deploy Portainer in your environment and manage your containers through a web-based interface.

Portainer is a graphical interface designed for managing Docker environments. You can use it to manage containers on your local system, remote systems, and for managing entire Swarm clusters.

Portainer runs as a container and its image is available in the official Docker registry.

Running Portainer

Portainer is simple to get running. It’s another Docker container that runs in your environment.

docker pull portainer/portainer

Create a Docker volume to store Portainer’s data. This is to ensure data remains persistent whenever the container is stopped and restarted.

docker volume create portainer_data

To quickly start a basic container for Portainer, run the following command. It will run the container as a service and expose port 9000 for the administrator web interface. Using the –restart-always flag ensure the container will continue running, even after a failure.

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

Data is kept persistent across container starts by mounting a data volume under the image’s /data/portainer/portainer directory.

Initial Configuration

Once your Portainer container is running you can access it from http://localghost:9000. You will be presented with a couple of configuration pages. The first of which asks for you to create an admin account.

After the admin account is created you will be asked what kind of Docker environment you would like to manage — a local host, a remote host, or a Docker Swarm.

Portainer - Docker environment selection
Portainer – Docker environment selection

After you select the environment your Portainer instance is configured. You will be present with the dashboard after setting any environment settings and then you click Connect. It’s really easy to deploy.

The Dashboard

The dashboard provides insight into the Docker environment. You view the number of running containers, the number of images and the storage they consume, see the number of volumes, and the number of networks.

Portainer dashboard
Portainer dashboard

App Templates

App templates presents a list of commonly used images available in the Docker registry. From this interface, we can quickly create new containers for our applications.

Containers

The containers page shows you a list of all containers, running and stopped. A menu bar located above and below the list allows quick access to frequent commands, such as starting and stopping containers; removing old, stopped containers; and pausing and resuming containers.

Portainer - Containers page
Portainer – Containers page

Each container listed has a quick actions menu. The graphs icon will open a resource monitoring page for the container, showing you information about memory usage and CPU consumption. Very handy to have when you need to see how a container is behaving on your system.

Logging is also accessible from the quick actions menu. The output from this page is the equivalent of running docker logs against a container from the command-line.

Jumping into a shell and running commands against a running container is also possible from the quick menu.

And finally, anyone wanting detailed information about a particular container can view it from the quick actions menu.

Honestly, anything anyone does day-to-day can be accomplished from the containers page. The interface feels fairly mature and has most of the things that anyone running containers expects.

Images

Manage all of your images from this page. Only basic information about an image is displayed. However, if you would like even more details, such as the environment variables used. you can click on an image to get that information.

Portainer images
Portainer images

As you can see you can pull down new images. If you have other registries registered, you can select which one to pull the image from.

This page also gives you the ability to create new images. Portainer provides a web editor you can type or paste your Dockerfile information in. If you have an image archived in a tarball, you can upload it. Another option is to point to a URL where your image can be downloaded from and have Portainer grab it and then save it.

Volumes

Managing volumes from the command-line can be a pain. Matters become even worse if you don’t map your volumes to known directories. If instead, you allow Docker to create volumes automatically, by not specifying a local target directory, you may find yourself struggling to identify which volumes belong to which images.

The volumes page addresses that issue. It even tells you whether an image is used by containers or not, which aids in cleaning up unused volumes to recover storage.

Portainer Volumes
Portainer Volumes

The limited information displayed on the front page is beneficial. The one thing missing that could improve this area is displaying the amount of storage consumed. We use volumes to maintain persistent data across our Docker containers of the same role. These roles could be a large database server or a large media store. Having more visibility into the storage being consumed would be helpful.

Portainer Settings

Portainer adds security and management features that are helpful in administering your Docker environment.

Authentication and User Management

Users can be stored in a local database (default) or from an LDAP server. That latter is targeted for larger, enterprise environments.  Navigating to Settings and then Authentication provides options to switch between local database and LDAP.

Docker Registries

Far away from the unprivileged users is the registries settings page. This allows you to register private registries and other public registries.

Additional Settings

There are a few other settings that haven’t been mentioned that I won’t go into great detail with. One these is the ability to hide containers from the UI. There are a variety of reasons why one would hide a container, but if it were for security reasons, it’s best to limit which user accounts can access those containers.

For organizations who like having their logo presented by their tools, the option exists under settings. The image would have to be hosted by a web server, as a URL is required.

Overall

Portainer feels like a fairly mature product. It’s open source and free, making it a simple decision to use. Run a Portainer container from your Docker host or Swarm node and then lock those servers down.  It’s a fantastic tool to allow less experienced admins administer your Docker environment, allowing them to do typical day-to-day activities without giving them the keys to your castle.

There are areas that could be improved, but there are enough solid features that the negatives are largely overshadowed.

If you want a frontend to your Docker environment and you are on a shoestring budget, don’t hesitate to jump on Portainer for your needs.