I have a docker swarm with a network network name: traefik-net type: overlay scope: swarm
Then i have a docker compose that works.
services:
angularDocs:
image: artifactory.company.com/containers/angular-docs:branchName
networks:
- traefik-net
labels:
- "traefik.http.routers.angularDocs.rule=Host(`branchName.angular.swarm.company.com`)"
- "traefik.http.services.angularDocs.loadbalancer.server.port=80"
networks:
traefik-net:
external: true
´´´
But instead of creating a compose file for each container image. I would like to do
docker service create --options artifactory.company.com/containers/angular-docs:branchName
but when i try like this, it does not work with traefik
docker service create --name angulardocs --label "traefik.http.routers.angulardocs.rule=Host(`branchName.angular.swarm.company.com`)" --label "traefik.http.services.angulardocs.loadbalancer.server.port=80" --network traefik-net artifactory.company.com/containers/angular-docs:branchName
In traefik 2.0 i get a route
Host(angulardocs-1-egyumq4nfke1lz3ohya38mwsj)
instead of Host(v8.angular.company.com)
It is like the the labels are configured wrong compared to when labels are in the compose file.
I hope somebody has an answer.