Docker+ swarm+etcd cluster problem

  docker, question

Environmental information

Server:

  • 192.168.99.100 centos-node1

  • 192.168.99.101 centos-node2

  • 192.168.99.102 centos-node3

Cluster information:

  • Etc Server: 192.168.99.100:2379

  • swarm manage: 192.168.99.101:2376

Get ready

  • Install dokcer on all machines

  • On centos-node1docker pull ystyle/etcd(It is the same as that on quay.io/coreos/etcd:v2.2.5. )

  • On all machinesdokcer pull swarm

Install etcdk-vDatabase

Execute on centos-node1:

export HOSTIP=192.168.99.100
 docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs -p 4001:4001 -p 2380:2380 -p 2379:2379 \
 --name etcd ystyle/etcd \
 -name etcd0 \
 -advertise-client-urls http://${HOSTIP}:2379,http://${HOSTIP}:4001 \
 -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
 -initial-advertise-peer-urls http://${HOSTIP}:2380 \
 -listen-peer-urls http://0.0.0.0:2380 \
 -initial-cluster-token etcd-cluster-1 \
 -initial-cluster etcd0=http://${HOSTIP}:2380 \
 -initial-cluster-state new

It is executed on three nodes respectively: join the cluster

docker run -d swarm join --addr=192.168.99.100:2375 etcd://192.168.99.100:2379/swarm
 docker run -d swarm join --addr=192.168.99.101:2375 etcd://192.168.99.100:2379/swarm
 docker run -d swarm join --addr=192.168.99.102:2375 etcd://192.168.99.100:2379/swarm

Start swarm manage on centos-node2

dokcer run -d -p 2376:2375 swarm manage -H=0.0.0.0:2375 etcd://192.168.99.101:2379/swarm

Then I found that no matter what command was executed by the cluster, there was no response, no error was reported, pull was unsuccessful, and images was empty.

Docker info information is also strange:

#docker -H tcp://192.168.99.101:2376 info
 Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
 Images: 0
 Server Version: swarm/1.1.3
 Role: primary
 Strategy: spread
 Filters: health, port, dependency, affinity, constraint
 Nodes: 2
 (unknown): 192.168.99.102:2375
 └ Status: Pending
 └ Containers: 0
 └ Reserved CPUs: 0 / 0
 └ Reserved Memory: 0 B / 0 B
 └ Labels:
 └ Error: (none)
 └ UpdatedAt: 2016-03-16T14:14:30Z
 (unknown): 192.168.99.101:2375
 └ Status: Pending
 └ Containers: 0
 └ Reserved CPUs: 0 / 0
 └ Reserved Memory: 0 B / 0 B
 └ Labels:
 └ Error: (none)
 └ UpdatedAt: 2016-03-16T14:14:30Z
 Plugins:
 Volume:
 Network:
 Kernel Version: 3.10.0-327.10.1.el7.x86_64
 Operating System: linux
 Architecture: amd64
 CPUs: 0
 Total Memory: 0 B
 Name: add02820f24f

The swarm node can only see two

#docker run --rm swarm list etcd://192.168.99.100:2379/swarm
 time="2016-03-16T14:19:41Z" level=info msg="Initializing discovery without TLS"
 192.168.99.101:2375
 192.168.99.102:2375

What is going on? Or did I fail to do it or did I miss it?

The problem has been solved. The main problem is the port. Just open the port in the firewall, and the duplicate docker id. Just delete the /etc/docker/key.json file and restart docker
Please see the specific construction process