Docker Community Forums

Share and learn in the Docker community.

How do I start a service on a specific node?

I am running a swarm of 2 nodes, I would like to run the image but different container ID, so that they are different operations. I am wondering if there is a way to directly scale the task out as a different container or start a container on a specific node?

~ Thanks in advance.

This is not how replicas are ment to be used. They are intened for identical replicas with identical configuration.

What you need is two distinct services with individual configuration and a placement contraint that restricts the service to be deployed to a specific node (or even a set of nodes once you have more nodes). In order to achive this, you would add a node label for the node and use it in the placement constraint.