I have a bit of a problem with docker swarm. I create 2 instances on DigitalOcean and i'll refer to them with public ip address 100.0.0.1 and 100.0.0.2 respectively. I ssh-ed into the first droplet as root and tried running the command docker swarm init
and it returned an error that eth0
is bound to 2 ip addresses the public ip address and a private ip address.
I then tried running docker swarm init --advertise-addr 10.0.0.1
as to prevent this and the swarm works. But whenever I try connecting to it from anywhere either the second droplet or my local machine using the join command it prints out it returns Error response from daemon: Timeout was reached before node was joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.
But it never connects to the swarm.
I tried running the same on ec2 without advertise-addr and it works perfectly the problem only arises when I am using DigitalOcean. Any help?
Thanks.

- 571
- 7
- 19
3 Answers
For DigitalOcean docker-18-04
image:
- Open ports, that Swarm manager need:
ufw allow 22/tcp
ufw allow 2376/tcp
ufw allow 2377/tcp
ufw allow 7946/tcp
ufw allow 7946/udp
ufw allow 4789/udp
ufw reload
ufw enable
These ports need to be open on both manager and worker nodes!
2. Restart Docker: systemctl restart docker
3. Check the name of your private network in Droplet:
ifconfig -a
4. Init swarm with docker swarm init --advertise-addr eth1:2377
where eth1
is the name of Droplet private network.
Than you will be able to join this network from worker nodes.

- 61
- 1
- 4
It appears that at the time of writing DigitalOcean's one-click-app for Docker is broken and fails in connecting swarm nodes for some reason. The only workaround I found was by running a normal ubuntu (or any other OS) image and manually installing Docker. That seemed to fix the problem.

- 571
- 7
- 19
It also worked for me. I tried with one click app that came with docker 17.12.0, and it didn't work. I then tried a fresh install of Ubuntu with docker 18.06.1 and it worked perfectly.

- 21,270
- 6
- 38
- 69