Skip to content

Instantly share code, notes, and snippets.

@oleg-brizy
Last active November 2, 2020 11:39
Show Gist options
  • Save oleg-brizy/414998474bd028e8a2c4665e735fd14e to your computer and use it in GitHub Desktop.
Save oleg-brizy/414998474bd028e8a2c4665e735fd14e to your computer and use it in GitHub Desktop.
Traefik in docker-compose
version: '3'
services:
traefik:
image: traefik:1.7.26-alpine
restart: unless-stopped
ports:
- 80:80
- 443:443
networks:
- traefik
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.toml:/traefik.toml
- ./acme.json:/acme.json
container_name: traefik
networks:
traefik:
external: true
debug = false
logLevel = "ERROR"
defaultEntryPoints = ["https","http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[entryPoints.https.redirect]
regex = "^https://www.(.*)"
replacement = "https://$1"
permanent = true
[retry]
[docker]
endpoint = "unix:///var/run/docker.sock"
watch = true
exposedByDefault = false
network = "traefik"
[acme]
email = "your@email.com"
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