can we deploy a container into a specific node in a docker swarm

痴心易碎 提交于 2019-12-03 16:37:06

问题


I have a docker swarm cluster, it contains 1 master 3 nodes. When we deploy a container through swarm master, e.g with the below command

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

Swarm will auto pick a node and deploy my container. Is there a way to hand pick a node? e.g I want to deploy a container in node 1.


回答1:


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

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

This would start the container on node1.



来源:https://stackoverflow.com/questions/36609890/can-we-deploy-a-container-into-a-specific-node-in-a-docker-swarm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!