HTTP 504 for docker swarm services when traefik is not hosted in docker

Hi there.

I'm converting my docker-compose setup to docker swarm mode and I've stumbled upon a problem with how traefik and Docker Swarm mode work together.

With the following compose file deployed through docker stack deploy I'm getting HTTP 504 when trying to reach the frontend through the configured rule (e.g. curl -v -H "Host:" http://localhost:80)

version: "3"

    image: mikesir87/cats
        traefik.port: 5000 cats_default

The following is the output from docker network ls:

NETWORK ID          NAME                DRIVER              SCOPE
bd4cbc4aa998        bridge              bridge              local
vg5aw0ghg5kg        cats_default        overlay             swarm
69a725b8a78b        docker_gwbridge     bridge              local
006701173ca0        host                host                local
p4ljq12j2htg        ingress             overlay             swarm
fc3838c62a62        none                null                local

The traefik.toml is largely unchanged from when I hosted things using docker-compose (which worked fine), apart from setting swarmMode=true.

The docker section of traefik.toml:

endpoint = "unix:///var/run/docker.sock"
swarmMode = true
watch = true
useBindPortIP = true

I tried enabling useBindPortIP, but it always logs the following: "Unable to find a binding for container \"cats_cats.1\", falling back on its internal IP/Port. In other words, disabling it does not change anything.

All examples I've seen on how to set up Docker Swarm mode and traefik use traefik in the same compose file and make sure they share the same internal docker network, but I can't find anything about this being required in the documentation.

Docker version

$ docker version
Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.39 (downgraded from 1.40)
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:29:29 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:02:44 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Traefik version

$ traefik version
Version:      v1.7.10
Codename:     maroilles
Go version:   go1.11.6
Built:        2019-03-29_12:20:34PM
OS/Arch:      linux/amd64

So my first question would be: Is it possible to run traefik against the Docker Swarm mode endpoint when traefik itself does not run inside Docker?

If that should be possible, what could be wrong in my setup?

I'm happy to provide more information if that's required.