Last active
December 25, 2022 18:32
-
-
Save debuglevel/cc904bb429d9d81adcb12f83f078c4e2 to your computer and use it in GitHub Desktop.
traefik docker-compose.yml in host network mode with basicAuth protected dashboard
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: | |
image: traefik:v2.5 | |
command: | |
#- "--log.level=DEBUG" | |
- "--providers.docker=true" | |
- "--providers.docker.exposedbydefault=false" | |
- "--entrypoints.web.address=:8888" | |
- "--api=true" | |
- "--api.dashboard=true" | |
# use host network so that we do not need to add every container into a traefik network | |
network_mode: host | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.dashboard.rule=Host(`traefik.huwi.rocks`)" | |
- "traefik.http.routers.dashboard.service=api@internal" | |
- "traefik.http.routers.dashboard.middlewares=auth" | |
# use the following line to generate a username/password thingy | |
# echo $(htpasswd -nb user password) | sed -e s/\\$/\\$\\$/g | |
- "traefik.http.middlewares.auth.basicauth.users=marc:SECRETSECRETSECRETSECRET" | |
# see https://github.com/traefik/traefik/issues/5732#issuecomment-894362338 or https://stackoverflow.com/questions/58580782/traefik-2-0-port-is-missing-for-internal-dashboard | |
- "traefik.http.services.dummy-svc.loadbalancer.server.port=8888" | |
whoami: | |
image: traefik/whoami | |
labels: | |
- "traefik.enable=True" | |
- "traefik.http.routers.whoami.rule=Host(`whoami.huwi.rocks`)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment