Skip to main content

Portainer

src

Portainer is a lightweight management UI which allows you to easily manage your Docker host or Swarm cluster.

It is an alternative to the Docker CLI and provides a web-based interface to manage containers, images, networks, and volumes.

Installation​

First lets make a directory for our Portainer data and then create a docker-compose file.

mkdir -p ~/local-cloud/portainer
touch ~/local-cloud/portainer/docker-compose.yml

Add the following to the docker-compose.yml file:

volumes:
portainer_d:

networks:
proxy:
external: true

services:
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
hostname: portainer
restart: always
ports:
- 9443:9443
networks:
- proxy
volumes:
- "//var/run/docker.sock://var/run/docker.sock"
- portainer_d:/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.portainer.entrypoints=web,websecure"
- "traefik.http.routers.portainer.rule=Host(`portainer.localhost`) || Host(`portainer.dev.localhost`)"
- "traefik.http.routers.portainer.tls=true"
- "traefik.http.routers.portainer.service=portainer@docker"
- "traefik.http.services.portainer.loadbalancer.server.port=9443"
- "traefik.http.services.portainer.loadbalancer.server.scheme=https"

Now lets start the Portainer service.

cd ~/local-cloud/portainer
docker compose up -d

You should now be able to access Portainer at https://portainer.localhost or https://portainer.dev.localhost if you have the DNS setup.

It will have you create a username and password. If you dont do it right away you will have to restart the container.

Usage​

Once you have logged in you will see the Portainer dashboard.

Portainer Dashboard

From here you can manage your Docker host or Swarm cluster.