Skip to content

Instantly share code, notes, and snippets.

@Starttoaster
Created April 28, 2019 20:48
Show Gist options
  • Save Starttoaster/c15f316830ac3d9cd22c125c62cf648b to your computer and use it in GitHub Desktop.
Save Starttoaster/c15f316830ac3d9cd22c125c62cf648b to your computer and use it in GitHub Desktop.
Portainer + Traefik
version: "2"
services:
# Reverse Proxy and Let's Encrypt
traefik:
container_name: traefik
image: traefik:alpine
restart: always
networks:
- srv
ports:
- 80:80
- 443:443
volumes:
- /opt/traefik/traefik.toml:/traefik.toml
- /var/run/docker.sock:/var/run/docker.sock
- /opt/traefik/acme.json:/acme.json
# Portainer
portainer:
container_name: portainer
image: portainer/portainer
restart: always
networks:
- srv
ports:
- "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/portainer:/data
labels:
- traefik.enable=true
- "traefik.frontend.rule=Host:port.MY-DOMAIN"
networks:
srv:
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "MY-DOMAIN"
exposedByDefault = false
watch = true
[acme]
email = "MY-EMAIL"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment