Thanks @ole . Your configuration looks fine for the Traefik part. The "Bad Gateway" error is clearly related to networks. You can verify this by accessing to the docker engine of the swarm node where your Traefik container is loacted, and run a docker exec -ti <container id> sh
to spawn an interactive commandline. From there, install curl
with apk add --no-cache curl
and try to access the backend container with curl -v http://<service ip><service port>
and see if it works or not. If it works, then Traefik is culprit and we should search for a configuration issue that I missed. If it does not works, then the issue lies within swarm network.
However, can you check the name of the networks that are really used with the command docker network ls
?
Based on https://docs.docker.com/compose/compose-file/#configs-configuration-reference:
- The directive
driver: overlay
is not taken in account: you can remove it, as the network is created outside the stacks. - The name
traefik-public
is only a reference inside the docker-compose, for docker-compose directives. It's not the real name that Traefik expects. My guess is that, on your environments where it's working, the newtork had been created with this exact name, but not on the one where it fails.