Hello,
I am trying to migrate from traefik v1 to traefik v2.
I am working with docker (without Swarm, this is real simple environment).
The same docker file is instantiated twice in different directories and with environment variable to set a different URL.
It was working fine with traefik v1 with the following label:
...
labels:
traefik.enable: "true"
traefik.frontend.rule: "Host: ${SERVICE:-cloud}.${DOMAIN:-localhost}"
...
With traefik v2, I am stuck on how this can be achieved.
My first try was like that:
...
labels:
traefik.enable: true
traefik.http.routers.cloud.rule=Host(`${SERVICE:-cloud}.${DOMAIN:-localhost}`)"
...
But traefik is raising a warning on the duplicate label declaration as the cloud
router is referenced 2 times.
I thought that I could solve this by replacing cloud
by the URL (the 2 instance have the same $SERVICE
value). But since there are dots in the domain name, it does not work.
Is there a way to define router names with dots ?
The doc is mentioning the "@" as being forbidden, but not the dot (even if it seems obvious looking at the label syntax).
I am trying to avoid adding a third environment variable to concatenate the URL if possible.
Any idea ?