Routing to a specific node in Docker Swarm

Hi there,

I have been looking through the docs and forums and have had no luck finding the answer to this.

I am running a global service in a Docker Stack (so 1 application per node), however, is there a way to create routes to a specific node running that service?

For example, a NodeJS application is running on node1, node2, node3.
Is there a way to create these routes?

Thanks for your time :slight_smile:

Hello @WestRider

Thanks for using Traefik and joining our community.

I don't think that it is possible to create a routing rule that will reach a particular node. However, I would deploy a service using node constraints and then create a routing rule based on Host and Path matchers.

What do you think about that approach?

Hi @jakubhajek

Thanks for the reply, I was thinking about doing that but hoped there was a more automated process. Since, the service is already constrained to a label that is shared across the suitable nodes, so was hoping there was a special variable I could put in the Host rule that would fill that in.

But will give the individual service per node a go, and try make use of YAML anchors so I only have to change the traefik labels per service :slight_smile:


1 Like