In Traefik V2 the .Name attribute in the defaultRule=Host( .Name .. ) prints the containerName-stackName instead only the containerName when using docker-compose.
Any idea how this can be removed ? This is my current rule:
- --providers.docker.defaultRule=Host(`{{ trimPrefix `/` .Name }}.containers.myorg.com`)
If my compose stack's name is monitoring, and the container is grafana this creates:
grafana-monitoring.containers.myorg.com
instead of
grafana.containers.myorg.com
Thanks
This seems to have worked for me:
- --providers.docker.defaultRule=Host(`{{if index .Labels "com.docker.compose.service" }}{{ index .Labels "com.docker.compose.service" }}.containers.myorg.com{{else}}{{ trimPrefix `/` .Name }}.containers.myorg.com{{end}}`)