Docker swarm overlay network not possible

I have no idea what the problem is
But I have a traefik.yml file which works perfectly on a normal docker-compose deployment with a network of Web. I can view my dashboard no problem with this deployment. As soon as I try to deploy this with the docker stack deploy command which uses an overlay network as default in a docker swarm environment it does not work at all. I get a 404 on the weboage end and I am also unable to route any of my other apps through it also because I also get a 404.

This is my config:

version: "3.3"

services:
  traefik:
    image: traefik:v2.0
    restart: always
    container_name: traefik
    ports:
      - "80:80"
      - "8080:8080"
      - "443:443"
    command:
      - --api.insecure=true
      - --api.dashboard=true
      - --api.debug=true
      - --log.level=DEBUG
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --providers.file.filename=/dynamic.yaml
      - --providers.docker.network=web
      - --entrypoints.web.address=:80
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./dynamic.yaml:/dynamic.yaml
    networks:
      - web
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule=Host(`monitor.domain.com`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.middlewares=api-auth"
      - "traefik.http.middlewares.api-auth.basicauth.users=admin:$$apr1$$idpFqhJJ$$8SdVdLF0B9k6CcVux2cKF."

networks:
  web:
    external: true

Any ideas?

I've seen this subject a few times here on the forums and around Google and it seems no one really knows what the problem is with docker swarm and traefik.

Hello @dynamicat

Thanks for using Traefik and posting the question here.

Would you please refer to the example configuration for Docker Swarm: traefik-proxy/traefik-stack.yaml at master · jakubhajek/traefik-proxy · GitHub

Here is the link to the docs that refers to the configuration argument that needs to be added as CLI (referring to your example):

https://doc.traefik.io/traefik/providers/docker/#network

Hi, sorry to revive an old thread, but I'm trying to use the example configuration you linked to @jakubhajek but it doesn't seem to work on my swarm.

I can hit /ping and get an OK response, but /dashboard gives me a 404.

If I comment out the routing for /dashboard and /api I can hit the dashboard on :8080/dashboard.

It also fails to pick up the config for whoami.

Rich

Hey @dutts

The correct URL in order to visit the dashboard is /dashboard/ - please mind the trailing slash in the URI. If the routing is correctly created you should get the dashboard in your browser.

Did you ever get this working? I too have a working config when using docker but after many days and many forums cannot get it working in swarm. I tried running the file from the github link above but can't get that working. Even that example has too many things going on and requires too many dns entries (wildcard won't work in my setup).