Hunor Kovács
Hunor Kovács

Reputation: 1294

Set up Docker Swarm on an EC2

Everything's running on a single AWS EC2 amz instance. No docker-machine, no additional VM, VirtualBox.

Docker daemon is running like this

ps aux | grep docker
... /usr/bin/docker -d -H tcp://0.0.0.0:2375

I'm executing:

sudo docker -H localhost:2375 run -d swarm join --addr=52.18.134.9:12375 token://52b27cb0a8187bfb358a35a4fdbf8922
sudo docker -H localhost:2375 run -d -p 12375:2375 swarm manage token://52b27cb0a8187bfb358a35a4fdbf8922

sudo docker -H localhost:2375 ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                     NAMES
16f93309d6c7        swarm:latest        "/swarm join --addr=   13 seconds ago      Up 13 seconds       2375/tcp                  lonely_babbage
c6a0e4e69bd2        swarm:latest        "/swarm manage token   6 minutes ago       Up 6 minutes        0.0.0.0:12375->2375/tcp   sleepy_wright

sudo docker -H localhost:12375 info
...
Nodes: 0
...

:(

https://docs.docker.com/swarm/install-manual/ is not clear enough it's not perfectly specified what is swarm_port, manager_port. I mean, i kind of understand, but i can't get it working (apparently).

(yea, ports 12375, 22 and 2375 are open from outside but that shouldn't matter here)

Upvotes: 0

Views: 580

Answers (1)

vieux
vieux

Reputation: 24387

The swarm joins require the ip:port of the docker daemon, not the swarm manager. So in your case, I guess the first line should be

sudo docker -H localhost:2375 run -d swarm join --addr=52.18.134.9:2375 token://52b27cb0a8187bfb358a35a4fdbf8922

Upvotes: 1

Related Questions