Docker Community Forums

Share and learn in the Docker community.

No elected primary cluster manager

(Dnewton) #1

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 ->
swarm1 ->
swarm2 ->
swarm3 ->

consul processes run on docker, swarm2, swarm3 with commands:

consul agent -server -bootstrap -data-dir /home/docker/data/consul -advertise= # on docker
consul agent -server -data-dir /home/swarm/data/consul -advertise= # on swarm2
consul agent -server -data-dir /home/swarm/data/consul -advertise= # on swarm3

Executing consul members shows consul cluster are up successfully.

Node Address Status Type Build Protocol DC
docker alive server 0.6.4 2 dc1
swarm2 alive server 0.6.4 2 dc1
swarm3 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 consul:// # primary

docker run -d dockerswarm/swarm:master manage -H :4000 --replication --advertise consul:// #secondary

And node0, node1 commands:
docker run -d swarm join --advertise= consul:// # node0

docker run -d swarm join --advertise= consul:// # 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
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 0
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?