Docker Community Forums

Share and learn in the Docker community.

Swarm on EC2 - swarm tutorial doesn't work on EC2


(Russell Jurney) #1

I posted this in the cloud forum but I think that was the wrong one so I’m posting it here.

I’ve gone through the Swarm tutorial successfully, and the EC2 tutorial successfully (and some other docker/ec2 work), and now I’m ready to create a swarm on EC2. I have done both of these things in isolation, but not together. However, I am finding that the swarm tutorial does not work on EC2. I am unable to connect to the swarm. Can someone point out where I’ve gone wrong? I thought it was a firewall issue, but that seems not to be the case so I am stumped.

My script is here (adapted from the swarm tutorial and the ec2 tutorial):

Note that unlike the docker EC2 tutorial, I had to specify a vpc or I can’t create a docker instance on ec2. I think this is a bug, but I was able to work around it thanks to a solution at the ticket for it (which I have lost) by specifying a public EC2 VPC.

At the end, I can’t connect to the swarm. Port 3376 was not opened in my docker security group (shouldn’t it be opened automatically?), so I manually set port 3376 to be available to my IP, then all IPs. Neither setting improved my inability to connect.

Any help would be greatly appreciated, thanks!

(Russell Jurney) #2

Crickets? Surely people are running swarm on EC2. Right?

(Dvohra) #3

Tested creating Docker Swarm cluster from Docker image on EC2, gets installed.

  1. Install Docker Swarm with the Docker image “swarm”.
    sudo docker run --rm swarm create
  2. Using the token returned start Docker Swarm Manager.
    docker run -t -p <swarm_port>:2375 -t swarm manage token://<cluster_id>
  3. Start Docker Swarm agents.
    docker run -d swarm join --addr=<node_ip:2375> token://<cluster_id>