Traefik with docker swarm as loadbalancer -> Bad Gateway

  • First of all, you only have to deal with exposed ports (aka. private only) between Traefik and the backend services: you can remove the directive
ports: 
     - 8515:8080

from the service myApp.

  • Your configuration seems right for the label traefik.http.services.myapp_service.loadbalancer.server.port : 8080 seems like the default port which Spring is listening on, hence the private port exposed by the container on the private network. Traefik will forward requests from the outside to this port.

Are you facing issues now or is it working? (I'm not sure if I understood correctly)