Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker-swarm >> Cannot connect to the docker engine endpoint

docker version 1.9.1
swarm version 1.0.1

why on connecting 3 VMs (bridged net) to swarm. "docker info" shows me all nodes

Status pending.

1 of 3 hosts is manager all output is from this host. I don't know where to look for.

On running swarm --debug manage token://XXXXX

output >>

*INFO[0000] Listening for HTTP addr=127.0.0.1:2375 proto=tcp

DEBU[0000] Failed to validate pending node: Cannot connect to the docker engine endpoint  Addr=10.32.1.38:2375

DEBU[0000] Failed to validate pending node: Cannot connect to the docker engine endpoint  Addr=10.32.1.4:2375

DEBU[0000] Failed to validate pending node: Cannot connect to the docker engine endpoint  Addr=10.32.1.33:2375

Then

root@ubuntu:~# ps -ef | grep swarm

root 2158  1391  0 12:28 pts/2 00:00:00 swarm join token://xxxxxxx --addr 10.32.1.4:2375

root 2407  1213  0 13:57 pts/1 00:00:00 swarm manage token://xxxxxxx -H 0.0.0.0:4243

root 2413  1391  0 13:57 pts/2    00:00:00 grep --color=auto swarm

Then

root@ubuntu:~# swarm list token://xxxxxxxxxxx

10.32.1.4:2375
10.32.1.33:2375
10.32.1.38:2375

Then

root@ubuntu:~# ps -ef | grep docker

root      2330     1  0 12:52 ?        00:00:00 /usr/bin/docker daemon

root      2421  1391  0 14:10 pts/2    00:00:00 grep --color=auto docker

heartbeat sorted - runs in background, checked ports, name resolution, pingable from manager.

like image 224
Julius Avatar asked Jan 15 '16 12:01

Julius


People also ask

How do you expose Docker daemon without TLS?

on the Notification bar, select Settings from the context menu, and then select the Expose daemon on tcp://localhost:2375 without TLS checkbox in the General section of your system Docker settings.

Where is my Docker daemon running?

Docker daemon directory By default this directory is: /var/lib/docker on Linux. C:\ProgramData\docker on Windows.


2 Answers

The docker daemon can listen on three different types of Socket: unix, tcp and fd.

By default, docker daemon just listen on unix socket.

If you need to access the Docker daemon remotely, you need to enable the tcp socket.

When creating docker swarm cluster, the swarm manager need to access the docker daemon of swarm agent nodes remotely.

Therefore, you need to re-configure the docker daemon

vim /etc/default/docker

Add following line:

DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"

Restart docker daemon

sudo restart docker

By doing this, the docker daemon can be accessed remotely.

References:

  1. Docker document: docker daemon
  2. Docker document: create a swarm for development
like image 190
KiwenLau Avatar answered Sep 18 '22 03:09

KiwenLau


I have added DOCKER_OPTS values in /etc/default/docker

DOCKER_OPTS="-H <>host IP<>:2375 -H unix:///var/run/docker.sock"

to be more precise << Host IP >> is same host IP you editing your /etc/default/docker file.

Maybe it will help someone.

like image 40
Julius Avatar answered Sep 19 '22 03:09

Julius