Following instruction at [1] to setup swarm, I get “Error response from daemon: No elected primary cluster manager.” error when trying the command docker -H :4000 run hello-world
The environment setup include 4 vms (using virtualbox) with
- debian kernel 3.16.0-4-amd64
- docker version 1.10.3, build 20f81dd
The mapping of 4 vms’ name to ip are
docker -> 192.168.1.103
swarm1 -> 192.168.1.107
swarm2 -> 192.168.1.105
swarm3 -> 192.168.1.104
respectively.
consul processes run on docker, swarm2, swarm3 with commands:
consul agent -server -bootstrap -data-dir /home/docker/data/consul -advertise=192.168.1.103 # on docker
consul agent -server -data-dir /home/swarm/data/consul -advertise=192.168.1.105 # on swarm2
consul agent -server -data-dir /home/swarm/data/consul -advertise=192.168.1.104 # on swarm3
Executing consul members
shows consul cluster are up successfully.
Node Address Status Type Build Protocol DC
docker 192.168.1.103:8301 alive server 0.6.4 2 dc1
swarm2 192.168.1.105:8301 alive server 0.6.4 2 dc1
swarm3 192.168.1.104:8301 alive server 0.6.4 2 dc1
Primary and Secondary managers run on swarm1 vm with commands:
docker run -d -p 4000:4000 dockerswarm/swarm:master manage -H :4000 --replication --advertise 192.168.1.107:4000 consul://192.168.1.103:8500 # primary
docker run -d dockerswarm/swarm:master manage -H :4000 --replication --advertise 192.168.1.107:4000 consul://192.168.1.103:8500 #secondary
And node0, node1 commands:
docker run -d swarm join --advertise=192.168.1.105:2375 consul://192.168.1.103:8500 # node0
docker run -d swarm join --advertise=192.168.1.104:2375 consul://192.168.1.103:8500 # node1
Unfortunately when checking swarm info with the command docker -H :4000 info
it looks like primary is not elected.
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: swarm/1.2.0
Role: replica
Primary:
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 0
Plugins:
Volume:
Network:
Kernel Version: 3.16.0-4-amd64
Operating System: linux
Architecture: amd64
CPUs: 0
Total Memory: 0 B
Name: 0070ecf9f3d4
Thus executing docker -H :4000 run hello-world
it throws error message
docker: Error response from daemon: No elected primary cluster manager.
How can I fix this problem?
Thanks
[1]. https://github.com/docker/swarm/blob/master/docs/install-manual.md#step-2-create-your-instances