We can deploy the container to a specific node in docker

I have a cluster of docker clans, it contains 1 master-3 node. When we deploy the container through the swarm master, for example, using the command

docker -H tcp://<master_ip>:5001 run -dt --name swarm-test busybox /bin/sh 

Roy automatically selects node and deploys my container. Is there a way to select a node? for example, I want to deploy a container in node 1.

+8
linux docker docker-swarm
source share
1 answer

Take a look at the Swarm filter docs. You can set various restrictions on what node Swarm should choose for any given container. For your case, try something like:

 docker run ... -e constraint:node==node1 ... 

This will launch the container on node1 .

+4
source share

All Articles