Last active
May 16, 2020 14:23
-
-
Save danieljfarrell/1a2ad9605ba757557042b510eee01286 to your computer and use it in GitHub Desktop.
This is a single file docker-compose.yml version of tutorial https://medium.com/@containeroo/traefik-2-0-docker-a-simple-step-by-step-guide-e0be0c17cfa5 where all static config. is also done in the compose yaml file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
traefik: | |
image: traefik:v2.0 | |
container_name: traefik | |
restart: unless-stopped | |
security_opt: | |
- no-new-privileges:true | |
networks: | |
- proxy | |
ports: | |
- 80:80 | |
- 443:443 | |
volumes: | |
- /etc/localtime:/etc/localtime:ro | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- letsencrypt:/letsencrypt | |
command: | |
# Static config from traefik.yml | |
- "--api.dashboard=true" | |
- "--entryPoints.http.address=:80" | |
- "--entryPoints.https.address=:443" | |
- "--providers.docker.endpoint=unix:///var/run/docker.sock" | |
- "--providers.docker.exposedByDefault=false" | |
- "[email protected]" | |
- "--certificatesResolvers.http.acme.storage=/letsencrypt/acme.json" | |
- "--certificatesResolvers.http.acme.httpChallenge.entryPoint=http" | |
labels: | |
# Dynamic config | |
- "traefik.enable=true" | |
- "traefik.http.routers.traefik.entrypoints=http" | |
# Required edit 1: Replace with your domain | |
- "traefik.http.routers.traefik.rule=Host(`traefik.example.com`)" | |
# Required edit 2: Replace username and password with username and hash of password as described in the tutorial | |
- "traefik.http.middlewares.traefik-auth.basicauth.users=username:password" | |
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https" | |
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect" | |
- "traefik.http.routers.traefik-secure.entrypoints=https" | |
# Required edit 3: Replace with your domain | |
- "traefik.http.routers.traefik-secure.rule=Host(`traefik.example.com`)" | |
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth" | |
- "traefik.http.routers.traefik-secure.tls=true" | |
- "traefik.http.routers.traefik-secure.tls.certresolver=http" | |
- "traefik.http.routers.traefik-secure.service=api@internal" | |
networks: | |
proxy: | |
external: true | |
volumes: | |
letsencrypt: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment