traefik.http.routers.dashboard.middlewares=test-auth

This commit is contained in:
1-h
2024-09-03 12:55:25 +08:00
parent 5994020cb2
commit 1513890bdc

View File

@ -10,7 +10,11 @@ services:
# The official v3 Traefik docker image # The official v3 Traefik docker image
image: traefik:v3.1 image: traefik:v3.1
command: command:
# docker run traefik:v3.1 --help
# Enables the web UI and tells Traefik to listen to docker # Enables the web UI and tells Traefik to listen to docker
- --providers.docker.exposedbydefault=false
- --log.level=DEBUG
- --api.insecure=true - --api.insecure=true
- --providers.docker - --providers.docker
@ -23,6 +27,26 @@ services:
# used during the challenge # used during the challenge
- --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web - --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
# Declaring the user list
#
# Note: when used in docker-compose.yml all dollar signs in the hash need to be doubled for escaping.
# To create user:password pair, it's possible to use this command:
#
#
# Also note that dollar signs should NOT be doubled when they not evaluated (e.g. Ansible docker_container module).
labels:
# https://doc.traefik.io/traefik/middlewares/http/basicauth/
# https://community.traefik.io/t/impossible-to-get-basic-auth-for-dashboard/5075/3
# lumxmTdz4g9s2e37
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`dashboard.traefik-example.oo1.dev`)"
- "traefik.http.routers.dashboard.tls=true"
- "traefik.http.routers.dashboard.tls.certresolver=myresolver"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=test-auth" # echo $(htpasswd -nB user) | sed -e s/\\$/\\$\\$/g
- "traefik.http.middlewares.test-auth.basicauth.users=user:$$2y$$05$$n8dGD49ATPyEYlfkpD6xpevszqPUrjhB3cdrmuGOVxziLsEN01IJa"
ports: ports:
# The HTTP port # The HTTP port
- "80:80" - "80:80"