Skip to content

Portainer

Setting Up Portainer on Docker Compose

Portainer is a container management software that can be used to Deploy, Troubleshoot and Securely Manage Applications across a variety of services such as Docker, Docker Swarm, Kubernetes, Cloud Deployments, Hybrid Cloud Deployments, On-Premise and/or Data Center Deployments

Why Choose Portainer

Portainer is a platform / service that can be run anywhere, on Bare Metal, in a VM, Docker container running locally, a kubernetes cluster, and anywhere else that can run Docker.

Docker Compose Example

volumes:
portainer-data:
driver: local
networks:
frontend:
external: true
services:
portainer:
container_name: portainer
image: portainer/portainer-ce:2.21.2-alpine
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./portainer-data:/data
labels:
- traefik.enable=true
- traefik.http.routers.portainer.rule=Host(`portainer.<domain>`)
- traefik.http.routers.portainer.entrypoints=https
- traefik.http.services.portainer.loadbalancer.server.port=9000
- traefik.http.routers.portainer.service=portainer
- traefik.http.services.portainer.loadbalancer.server.scheme=http
- traefik.http.routers.tls=true
- traefik.http.routers.portainer.tls.certresolver=myresolver
- "--certificatesresolvers.myresolver.acme.dnschallenge=true"
- "--certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare"
restart: unless-stopped
networks:
- frontend

Start Portainer

Start Authentik by running the following command from within the folder / location where the docker compose file for Authentik has been stored.

docker compose up -d

Key Components of Docker Compose Configuration Explained

  • Image - Specifies the Portainer server image and tag
  • Ports - Exposes Portainer on specified port
  • Volumes - For media files and custom templates
  • Labels - Used by Traefik to provide external access to the service, once the service all its dependancies have been started are "healthy" and Accessible, Public Service Name and what provider to use to check and obtain for an SSL Certificate