Last active
April 9, 2023 18:31
-
-
Save Maescool/7ec9836c48e53de79cc51fb70fbe1388 to your computer and use it in GitHub Desktop.
Traefik V2 docker-compose example with dashboard and SSL
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.3' | |
services: | |
traefik: | |
# The official v2.0 Traefik docker image | |
image: traefik:v2.0 | |
container_name: traefik | |
restart: unless-stopped | |
security_opt: | |
- no-new-privileges:true | |
networks: | |
- proxy | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.traefik.entrypoints=http" | |
- "traefik.http.routers.traefik.rule=Host(`traefik.your-domain.com`)" | |
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect" | |
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https" | |
- "traefik.http.routers.traefik-secure.entrypoints=https" | |
- "traefik.http.routers.traefik-secure.rule=Host(`traefik.your-domain.com`)" | |
- "traefik.http.routers.traefik-secure.tls=true" | |
- "traefik.http.routers.traefik-secure.tls.certresolver=http" | |
- "traefik.http.routers.traefik-secure.service=api@internal" | |
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth" | |
- "traefik.http.middlewares.traefik-auth.basicauth.users=adminuser:htpassword" | |
ports: | |
# The HTTP port | |
- "80:80" | |
- "443:443" | |
volumes: | |
- "./data/acme.json:/acme.json" | |
- "./data/traefik.yml:/traefik.yml:ro" | |
- "/etc/localtime:/etc/localtime:ro" | |
# So that Traefik can listen to the Docker events | |
- "/var/run/docker.sock:/var/run/docker.sock:ro" | |
networks: | |
proxy: | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment