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