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

  • Creating a swarm cluster with Docker for Mac
  • How I can connect wp container with ajenti container?
  • How to update Kafka config file with Docker IP address
  • Java8 base image has java7 installed docker
  • how docker-machine uses docker api to copy certificates
  • How to we login to docker hub(private registry) using chef recipe?
  • 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)

  • Unable to mount MySQL data volume to Kubernetes Minikube pod
  • Should I Compile My Application Inside of a Docker Image
  • How to change Docker default subnet size?
  • Running SystemTap inside an unprivileged docker container
  • Deleting files inside docker container not freeing up space on host system
  • I can't get red5-hls-plugin to build
  • One Solution collect form web for “Set up Docker Swarm on an EC2”

    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
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.