Docker Community Forums

Share and learn in the Docker community.

Docker swarm + stack, how can service instances have affinities?

(Salketer) #1

Hello everyone,

I’m trying to work on a simple setup of 3 servers. For testing purposes and cost savings, I’ll replicate all my services 3 times, once for each node, counting on the swarm load balancing to work its charms.

The problem I am seeing here is that I have two services that are very bound to each other. Basically, it’s a fetching task plus a computing task. The fetcher pulls the required data from different sources, sends it to the computing unit (through shared volume), and then asks it some questions.

As you can see, the fetching task absolutely need to always reach the same computing unit. At least throughout the given task.

Is there a way to link two services so that they always use the same task? Like if I have fetcher_1 it always reaches compute_1?

Thanks for your tips.