Portainer Tutorial – Everything about Stacks, Networks, Images Docker

English Portainer Tutorial - Steffen Lippke Coding Lab

Do you need a Portainer tutorial?

This guide gives you a simple introduction.

All Portainer peculiarities are explained in this guide!

Let’s get started!

What is Portainer? – Simple explanation

Umgebungen
Environments

The Portainer software helps you to manage your Docker container, Azure ACI, Nomad and Kubernetes. These software products offer a command line interface, which Portainer uses as a user interface. You can host Portainer yourself as a Docker container and operate it in the browser.

The software focuses on the management of multiple (different) servers from a central machine. Separate concepts such as the “stack” attempt to “simplify” more complex Docker Swarm concepts.

What is Docker?

Docker software is a type of container virtualisation. Instead of booting up an entire virtual machine with a fully-fledged operating system on the host system, a container saves resources for the running applications. It shares resources with the host system. Not every container runs on every host system because the container uses tools and resources from the host system in places.

Dashboard für die Übersicht - Portainer Tutorial Steffen Lippke Coding Lab
Dashboard for an overview – Portainer Tutorial Steffen Lippke Coding Lab

The application programmes run in these execution environments, which only receive the necessary software dependencies. Containerisation allows very flexible operation of the IT infrastructure (scaling, moving, shutting down, resource distribution).

Docker makes it possible to run multiple instances of an application on one or more hosts and load balancers on a powerful machine without the instances interfering with each other.

What is Docker Swarms?

The “Docker Swarms” system works as a management system, similar to Kubernetes and OpenShift. This is called container orchestration.

The Swarm Manager monitors the instances and starts new ones if individual ones crash (error case).

The overlay networks span an internal network across all container nodes (on all physical computers). This virtual network functions fully virtualised without an external network configuration. Transport Layer Security (TLS) protects the communication between the physical computers so that no third party can record it.

Why use Portainer

#1 You need more clarity

The Docker software is a command line interface and can only be used with the terminal. Because no command line interface is cumbersome due to typing, a graphical UI is better.

Images accumulate quickly

If you have more than one container running on your machine at the same time, the CLI commands can quickly become confusing. Portainer supports paging, formatted tables and various interactions with them:

  • Start / Stop / Delete
  • Read logs
  • Jump to the bash of the container
  • Display metadata
  • Overview of containers, networks, images and much more.

#2 Simple control for more efficiency

Some routine tasks are easier to use with a graphical user interface. This includes, for example, starting and stopping the Docker Swarms or reading the logs. You can achieve the same thing using CLI commands, but it takes longer (despite your 500 keystrokes per minute).

#3 Working on multiple servers at the same time

Portainer works locally on your computer and from there you administer several physical servers at the same time. Instead of opening thousands of terminal windows and executing the same commands over and over again, you can get more done in less time with the Portainer user interface.

The Portainer Guide

Preparation

First you need Docker on your server / workstation. Install the Docker.exe for a Windows machine or in a Debian-based system with the package manager APT docker.io

sudo apt-get install docker.io

The Portainer software not only manages Docker containers, but is itself a Docker container. The easiest way to start a Docker container is with a docker-compose file. This file contains all the configurations and settings for the Docker container.

In the second step, install the docker plugin docker-compose:

sudo apt-get install docker-compose-plugin

You can start Portainer as a simple Docker command:

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

You should then see the new container after a few minutes with the docker ps command.

Discover the user interface

Go to https://localhost:9443

Create a user account with name and password.

Login Screen
Login screen

You can now use Portainer locally to organise your Docker work. Alternatively, you can now add further environments. Environments are the physical computers / servers on which Docker, Kubernetes or other virtualisation environments are running. The environments require a Docker installation.

A normal Portainer installation is not necessary, but a Portainer Agent installation.

The agent receives commands from the master (your workstation) about which containers are to be created and how. You can also dial in directly on the node (via the Portainer UI). The disadvantage is that you cannot manage the Docker containers from the server node.

Stacks
Stacks

Before Docker containers can talk across multiple servers / computer nodes, you first create an overlay network, which is a virtual, internal Docker network. This connects the Docker containers across computers. The service with the Docker agent then manages the Docker on the physical machine.

docker network create \ --driver overlay \ portainer_agent_network
docker service create \ 
--name portainer_agent \ 
--network portainer_agent_network \ 
-p 9001:9001/tcp \ 
--mode global \
--constraint 'node.platform.os == linux' \ 
--mount
 type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \
--mount
 type=bind,src=//var/lib/docker/volumes,dst=/var/lib/docker/volumes \
 portainer/agent:2.15.1

Portainer Menu Options

Overview is important – Dashboard

The dashboard shows the most important key figures for your host computer. How many images, volumes or networks are stored? How powerful is the machine / server (RAM, CPUs, GPUs)? Are virtual networks available?

For all lazy people – app templates

The app templates are ready-made Portainer configurations that you can install with little effort. Instead of spending 10 hours tinkering with the perfect configuration for a container, the templates (app templates) usually run immediately. Pay attention to the architecture of your computer.

App templates are a must for every lazy bone

Please do not lose any data – volumes

Docker containers do not store any user data. If you shut down the container, all changes disappear. Docker volumes solve this problem. Docker stores all volumes in a central folder.

Volumes
Volumes

Apps served ready to use – images

Docker images are binary blobs that contain the programmes, environment variables, dependencies and configurations. The images must be compatible for your system: x86, ARM or older architectures. Not every image is available for every architecture (Raspberry Pi 32 bit).

You can find Docker images under Docker Hub or in the GitHub repos

Let’s talk – Networks

Docker offers an internal Docker network. Instead of connecting physical computers with network cables, you manage an internal network virtually. Docker is a data centre in a computer – all virtualised. This allows you to encapsulate containers, create subnets and enable communication between the containers. You don’t have to plug in a physical cable and the programmes run independently of each other.

All images – Registry

The Portainer Registry in conjunction with Docker works like a warehouse for finished programmes, so-called images, which can be started with Docker. A registry is an online storage location where these images are stored, for example Docker Hub or a private registry in a company. Portainer is a graphical user interface that simplifies the administration of Docker.

Registry for storing images

Instead of entering complex commands in the command line, Portainer allows you to simply click to start containers or download images. A connection to a registry can be set up in Portainer by entering the name of the registry and, if necessary, access data. Once the connection has been established, images can be searched from the registry and downloaded to the Docker environment.

version: "3.9"
services:
  registry:
    image: registry:latest
    container_name: registry
    restart: always
    ports:
      - 5000:5000
    environment:
      REGISTRY_AUTH: htpasswd
      REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
      REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
      OTEL_TRACES_EXPORTER: none
    volumes:
      - registrystorage2:/var/lib/registry
      - /home/steffen/auth:/auth    

volumes:
  registrystorage2:

These images can then be started in Portainer as containers, which means that the software is activated. For example: You set up a connection to Docker Hub in Portainer, search for an image such as “nginx” (a web server), download it via Portainer and start a container based on this image. Portainer therefore simplifies access to Docker images and makes administration clearer.

Practical stacks

Portainer’s own “stacks” concept is based on a Docker-Compose file, which acts as a Docker swarm. If an instance crashes from a stack, Portainer starts a new instance. A Portainer stack does not create a docker build that you have integrated into your compose. You must first build the image on the local machine, pull it onto the server via Git repository via upload or push and then you can start the stack.

Stacks are versatile = Docker Compose

This Docker Compose starts a MariaDB (MySQL database) with the PhpMyAdmin user interface. When you start up your computer, the database also starts up

version: '3.8'

services:
  mariadb:
    image: mariadb:lastest
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_USER: superdupperuser
      MYSQL_PASSWORD: changemenow
    ports:
        - "3306:3306"
    volumes:
     - mariadb:/var/lib/mysql
    networks:
      db:

  phpmyadmin:
    image: phpmyadmin
    restart: always
    expose:
      - "80"
    ports:
      - "80:80"
    environment:
      - PMA_HOST=mariadb
      - PMA_PORT=3306 
    networks:
      db:

volumes:
  mariadb:
    driver: local

networks:
  db:
    driver: bridge

Dieser Beitrag ist zitierfähig. Adaptiere das Beispiel nach dem Harvard Stil: Lippke, Steffen (2026): ‘Programmieren lernen – Tutorial für Einsteiger’, Security and Coding Explosive Tutorials [online], 01. Januar 2026. Verfügbar unter: https://lippke.li/programmieren-lernen/, ISSN: 3054-3436

Leave a Reply

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