Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

traefik : how to use basic auth when using docker-compose?

Tags:

traefik

I'm trying to use traefik with docker compose.

According to the threads I've seen on their site, you could use something like this :

mytest-steph: image: myimage ports: - "45001:45001" labels: - "traefik.backend=test_steph" - "traefik.frontend.rule=Host:test.mydomain.com;PathPrefix:/myprefix" - "traefik.backend.port=8080" - "traefik.frontend.auth.basic=test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"

But when I launch docker-compose up, I get : WARNING: The apr1 variable is not set. Defaulting to a blank string. WARNING: The H6uskkkW variable is not set. Defaulting to a blank string. WARNING: The IgXLP6ewTrSuBkTrqE8wj variable is not set. Defaulting to a blank string.

Does anyone achieve to use basic auth like that ?

like image 726
Stephane DEWITTE Avatar asked Dec 04 '22 21:12

Stephane DEWITTE


1 Answers

I've found the answer. You have to double every "$" character.

For example:

  • "traefik.frontend.auth.basic=test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"

will become:

  • "traefik.frontend.auth.basic=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/"
like image 165
Stephane DEWITTE Avatar answered Mar 23 '23 05:03

Stephane DEWITTE