swarm manager does not connect to nodes docker daemons on AWS

0 votes

I'm trying to configure a simple docker swarm example on AWS.I have one manager and two worker nodes.

docker-machine create --driver amazonec2 --amazonec2-region eu-central-1 swarm-manager
docker-machine create --driver amazonec2 --amazonec2-region eu-central-1 docker1
docker-machine create --driver amazonec2 --amazonec2-region eu-central-1 docker2

I've set up docker1 and docker2 

set up /etc/default/docker:

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

rebooted docker and then:

sudo docker run -d swarm join --addr=172.31.5.27:2375 token://<token>

and checked it:

ubuntu@docker1:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
a4ae06e827a6        swarm               "/swarm join --addr=1"   28 minutes ago      Up 28 minutes       2375/tcp            admiring_blackwel

on the swarm machine:

sudo docker run -dP swarm manage token://

and I added my nodes:

ubuntu@swarm-manager:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
67f55fda2eba        swarm               "/swarm manage token:"   16 minutes ago      Up 16 minutes       0.0.0.0:32768->2375/tcp   trusting_dijkstra

ubuntu@swarm-manager:~$ docker -H tcp://127.0.0.1:32768 info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: swarm/1.2.5
Role: primary
Strategy: spread
Filters: health, port, containerslots, dependency, affinity, constraint
Nodes: 2
 (unknown): 172.31.11.143:2375
  └ ID:
  └ Status: Pending
  └ Containers: 0
  └ Reserved CPUs: 0 / 0
  └ Reserved Memory: 0 B / 0 B
  └ Labels:
  └ Error: Cannot connect to the Docker daemon. Is the docker daemon running on this host?
  └ UpdatedAt: 2016-10-29T16:34:28Z
  └ ServerVersion:
 (unknown): 172.31.5.27:2375
  └ ID:
  └ Status: Pending
  └ Containers: 0
  └ Reserved CPUs: 0 / 0
  └ Reserved Memory: 0 B / 0 B
  └ Labels:
  └ Error: Cannot connect to the Docker daemon. Is the docker daemon running on this host?
  └ UpdatedAt: 2016-10-29T16:34:38Z
ServerVersion:
Plugins:
 Volume:
 Network:
Swarm:
 NodeID:
 Is Manager: false
 Node Address:
Security Options:
Kernel Version: 4.2.0-18-generic
Operating System: linux
Architecture: amd64
CPUs: 0
Total Memory: 0 B
Name: 67f55fda2eba
Docker Root Dir:
Debug Mode (client): false
Debug Mode (server): false
WARNING: No kernel memory limit support

I can't undersrtand why imy nodes are still pending.

Aug 24, 2018 in Docker by lina
• 8,220 points
1,839 views

1 answer to this question.

0 votes

You first need to ssh into the swarm manager using the following command:

 docker-machine ssh aws-swarm-mgr

initiate the docker swarm on the manager node

docker-swarm init --advertise-addr Ip_addr --listen-addr IP_addr

When you execute the init command you'll get a command to be executed on your worker nodes to join them to the swarm cluster initiated by the manager

something like this

and run from docker1 node and docker2 node

docker swarm join --token xxxLOREMIPSUMTOKENx ip:2377

answered Aug 24, 2018 by Nilesh
• 7,060 points

Related Questions In Docker

0 votes
1 answer
+3 votes
4 answers

Not able to connect worker nodes to the swarm. Connection refused error

This definitely has to be a firewall issue. ...READ MORE

answered Apr 26, 2019 in Docker by Vaidya
18,774 views
+2 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
3,924 views
0 votes
1 answer

Init could not choose ip address error while doing docker swarm init

First look for the public IP of ...READ MORE

answered Aug 23, 2018 in Docker by Nilesh
• 7,060 points
3,479 views
0 votes
1 answer

Docker Swarm- Build image only when stack deployed from manager node

Use docker build to build the image. ...READ MORE

answered Aug 24, 2018 in Docker by Nilesh
• 7,060 points
1,286 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP