Docker Community Forums

Share and learn in the Docker community.

Swarm connect to specific containers

swarm

(Photostu) #1

Is it possible to connect to a specific container inside of a swarm?
My use case is the following: I want to spin up N slave containers and 1 master container.
The master container needs to know the state of each slave, each slave would report its state to the master. Slaves will be doing various work loads, when a request comes into the master container, it needs to know which slaves are working and which are idle to route the request. Since swarm mode is already routing requests, am I stuck with not being able to do this work? For my use case, each slave has to be a unique container.

Thanks for your time :slight_smile:


(Photostu) #2

One option I thought to do would be to just have the master keep asking a “slave” are you busy? If it gets an idle one, the work can be passed along. This would not require knowing which ones were active or idle, but then I have to write a loop to continue asking until I get an idle response, not ideal.