我有一个swarm管理器和两个swarm节点,我想根据我在docker deamon上定义的一些标签启动一个容器。这是我试过的命令:
docker -H :2376 run -e constraint:node==docker2 image/restservice
docker: Error response from daemon: Unable to find a node that satisfies the following conditions
[available container slots]
[node==docker2].
如果我使用swarm运行docker info,这就是我得到的。
Containers: 13
Running: 4
Paused: 0
Stopped: 9
Images: 54
Server Version: swarm/1.2.3
Role: primary
Strategy: spread
Filters: health, port, containerslots, dependency, affinity, constraint
Nodes: 2
docker-node-1: 192.168.56.104:2375
└ ID: I32N:D2XQ:I2FL:WDDR:YQ32:BJ62:XRWJ:7TDR:XD74:IH5M:Y2W2:4PD6
└ Status: Healthy
└ Containers: 7
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 2.061 GiB
└ Labels: executiondriver=, kernelversion=3.16.0-4-amd64, node=docker2, operatingsystem=Debian GNU/Linux 8 (jessie), storagedriver=aufs
└ UpdatedAt: 2016-08-16T18:47:05Z
└ ServerVersion: 1.11.1
docker-node-2: 192.168.56.106:2375
└ ID: 6VAY:KCMX:JTTG:SQXW:BFMK:MPNJ:AWEL:F3LT:FCXI:SQRO:ORDK:MOHY
└ Status: Healthy
└ Containers: 6
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 2.061 GiB
└ Labels: executiondriver=, kernelversion=3.16.0-4-amd64, node=docker3, operatingsystem=Debian GNU/Linux 8 (jessie), storagedriver=aufs
└ UpdatedAt: 2016-08-16T18:47:19Z
└ ServerVersion: 1.11.1
Plugins:
Volume:
Network:
Kernel Version: 3.16.0-4-amd64
Operating System: linux
Architecture: amd64
CPUs: 2
Total Memory: 4.123 GiB
Name: bdf49c666300
Docker Root Dir:
Debug mode (client): false
Debug mode (server): false
WARNING: No kernel memory limit support
我错过了吗?
答案 0 :(得分:0)
在群体模式中,首先你不要运行容器本身。您运行将运行容器的服务。并且您的约束不会以正确的方式创建服务。我认为学习正确方法的最佳方法是通过docker service创建cli引用。 https://docs.docker.com/engine/reference/commandline/service_create/