Installation of Container Manager Portainer behind Traefik
Set up the container manager Portainer behind Traefik as reverse proxy. Manage your Docker containers conveniently via the web interface from anywhere.
CAUTION
Please note that this blog post was originally written in German and has been translated for your convenience. Although every effort has been made to ensure accuracy, there may be translation errors. I apologize for any discrepancies or misunderstandings that may result from the translation and I am grateful for any corrections in the comments or via mail.
I generally prefer to control my Docker containers directly via my server or use Lazydocker for visual help. However, sometimes (especially on the road) it is also convenient not to have to establish an SSH connection to the server in order to manage certain containers or view the logs. This is where Portainer comes into play.
Portainer | Open Source Container Management GUI for Kubernetes, Docker, Swarm Portainer is the definitive open source container management GUI for Kubernetes, Docker, Swarm and ACI.
Traefik should be set up as a reverse proxy for my configuration file, as described here. Then we need a folder for the data and the Docker-Compose file.
cd ~/docker
mkdir appdata/portainer/data -p
nano docker-compose-portainer.yml
We add the following text to this file.
version: "3.7"
### NETWORKS ###
networks:
web:
external:
name: web
default:
driver: bridge
### Services ###
services:
portainer:
container_name: portainer
image: portainer/portainer-ce:latest
restart: unless-stopped
command: -H unix:///var/run/docker.sock
networks:
- web
security_opt:
- no-new-privileges:true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- $DOCKERDIR/appdata/portainer/data:/data
environment:
- TZ=$TZ
labels:
- "traefik.enable=true"
- "traefik.http.routers.portainer-rtr.entrypoints=https"
- "traefik.http.routers.portainer-rtr.rule=Host(`portainer.$DOMAINNAME`)"
- "traefik.http.routers.portainer-rtr.tls=true"
# - "traefik.http.routers.portainer-rtr.middlewares=chain-basic-auth@file" # Basic Authentication
- "traefik.http.routers.portainer-rtr.middlewares=chain-oauth@file" # Google Authentication
- "traefik.http.routers.portainer-rtr.service=portainer-svc"
- "traefik.http.services.portainer-svc.loadbalancer.server.port=9000"
We use the official image.
docker-compose -f docker-compose-portainer.yml up -d
Done. Portainer should now be visible under our Portainer subdomain.
An update to a later release can also be carried out very easily.
docker-compose -f docker-compose-portainer.yml pull
docker-compose -f docker-compose-portainer.yml down
docker-compose -f docker-compose-portainer.yml up -d Related Articles
Self-Host Calibre with Docker and Traefik Reverse Proxy
Set up a self-hosted e-book manager with Calibre and Calibre-Web as GUI behind Traefik reverse proxy. Manage your e-books privately on your own server.
Self-Host Commento++ with Docker and Traefik Reverse Proxy
Replace Disqus with Commento++, a privacy-friendly commenting system. Self-host it with Docker and Traefik reverse proxy for full data control on your blog.
Set Up Ghost CMS with Docker & Traefik: Full Guide
Run Ghost CMS with Docker behind a Traefik reverse proxy. A step-by-step guide for building your own blog system with SSL and a custom domain – get started now!
Setting up n8n automation with Docker behind Traefik
Automate workflows efficiently with n8n. Set it up with Docker and Traefik as a reverse proxy, including SSL and practical examples – save time automating!