The basic example for routing in the configuration is
version: "3"
services:
my-container:
# ...
labels:
- traefik.http.routers.my-container.rule=Host(`example`)
my-container
is the name of the service and it is mentioned in the rule.
The example for multiple routes is different:
version: "3"
services:
my-container:
# ...
labels:
- traefik.http.routers.www-router.rule=Host(`example-a`)
- traefik.http.routers.www-router.service=www-service
- traefik.http.services.www-service.loadbalancer.server.port=8000
- traefik.http.routers.admin-router.rule=Host(`example-b`)
- traefik.http.routers.admin-router.service=admin-service
- traefik.http.services.admin-service.loadbalancer.server.port=9000
Here the name of the service is not mentioned and made-up (?) names are used.
Does this mean that what is between routers
and rule
does not matter?
In other words could I always have (for all my containers) the same name, such as
(in one container)
traefik.http.routers.X.rule=Host(`example`)
(in another container)
traefik.http.routers.X.rule=Host(`foo`)
The basic example for routing in the configuration is
version: "3"
services:
my-container:
# ...
labels:
- traefik.http.routers.my-container.rule=Host(`example`)
my-container
is the name of the service and it is mentioned in the rule.
The example for multiple routes is different:
version: "3"
services:
my-container:
# ...
labels:
- traefik.http.routers.www-router.rule=Host(`example-a`)
- traefik.http.routers.www-router.service=www-service
- traefik.http.services.www-service.loadbalancer.server.port=8000
- traefik.http.routers.admin-router.rule=Host(`example-b`)
- traefik.http.routers.admin-router.service=admin-service
- traefik.http.services.admin-service.loadbalancer.server.port=9000
Here the name of the service is not mentioned and made-up (?) names are used.
Does this mean that what is between routers
and rule
does not matter?
In other words could I always have (for all my containers) the same name, such as
(in one container)
traefik.http.routers.X.rule=Host(`example`)
(in another container)
traefik.http.routers.X.rule=Host(`foo`)
Share
Improve this question
asked Feb 16 at 7:38
WoJWoJ
30k58 gold badges213 silver badges401 bronze badges
1 Answer
Reset to default 1You need to use different names for Traefik routers
, middlewares
and services
- otherwise you are overwriting existing ones across Docker services.