Reputation: 380
By default, Traefik creates a frontend rule for newly started docker containers:
https://docs.traefik.io/configuration/backends/docker/
traefik.frontend.rule=EXPR | Overrides the default frontend rule. Default: Host:{containerName}.{domain} or Host:{service}.{project_name}.{domain} if you are using docker-compose.
I am using docker-compose, and this default behavior is not useful to me. I want to use a docker label and change the frontend rule to be Host:{hostname}.{domain}
or even the default non-compose {containerName}.{domain}
, but this does not work. The label does not get parsed. The rule ends up being the literal label string.
I do not understand the documentation.What exactly is the EXPR in traefik.frontend.rule=EXPR
?
Upvotes: 2
Views: 1767
Reputation: 13
The {hostname}
and {domain}
is just to show that the default will take the values from docker. It, unfortunately, doesn't do replacement from global values like it would seem with how that is written.
The EXPR
would be any sort of traefik rule expression like "Host: myapp.example.com"
. More examples can be seen in the documentation here: https://docs.traefik.io/basics/#examples
Upvotes: 1