I have a working traefik instance running in docker swarm. I have successfully deployed a number of services using docker labels. Trying to add another docker, I have used a working docker-compose file but then updated the settings for the service but traefik is not picking up the new service.
Can anyone help me see what I've done wrong here please?
Docker compose for traefik
services:
traefik:
image: "traefik:3.0"
ports:
- target: 80
published: 80
protocol: tcp
mode: host
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- ".:/etc/traefik"
networks:
- services
command:
- --log.level=DEBUG
- --log.format=json
- --api.dashboard=true
- --accessLog=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false # makes it a requirement to have a traefik.enable=true
- --entrypoints.web.address=:80
- --providers.docker.httpClientTimeout=300
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
labels:
- "traefik.enable=true"
- "traefik.docker.network=services"
- "traefik.http.routers.dashboard.rule=Host(`localhost`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))"
- "traefik.http.routers.dashboard.priority=1001"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.entrypoints=web"
networks:
services:
external: true
docker compose for working service:
services:
auth:
build:
context: ./
target: auth-base
volumes:
- ./config/.env.local:/usr/app/.env.local:r
- ./config/.env.secrets:/usr/app/.env.secrets:r
- ./config/.env.common:/usr/app/.env.common:r
- ./config/.env.auth:/usr/app/.env.auth:r
- .:/usr/app/:delegated
networks:
- services
ports:
- "3000"
environment:
NODE_ENV: development
PORT: 3000
labels:
- "traefik.enable=true"
- "traefik.docker.network=services"
- "traefik.http.routers.auth.rule=Host(`localhost`) && PathPrefix(`/api/auth`)"
- "traefik.http.routers.auth.priority=1010"
- "traefik.http.routers.auth.entrypoints=web"
restart: unless-stopped
command: npm run dev
networks:
services:
external: true
docker compose for the one that traefik isn't seeing:
services:
lobby:
build:
context: ./
target: lobby-deps
volumes:
- ./config/.env.local:/usr/app/.env.local:r
- ./config/.env.secrets:/usr/app/.env.secrets:r
- ./config/.env.common:/usr/app/.env.common:r
- ./config/.env.lobby:/usr/app/.env.lobby:r
- .:/usr/app/:delegated
networks:
- services
ports:
- "3000"
environment:
NODE_ENV: development
PORT: 3000
labels:
- "traefik.enable=true"
- "traefik.docker.network=services"
- "traefik.http.routers.lobby.rule=Host(`localhost`) && PathPrefix(`/`)"
- "traefik.http.routers.lobby.priority=100"
- "traefik.http.routers.lobby.entrypoints=web"
restart: unless-stopped
command: npm run dev
networks:
services:
external: true