Need Explanation for the docker documentation on the swarm

I finished this documentation:

https://docs.docker.com/swarm/install-w-machine/

  • Docker : Drupal container linked to mysql container can't connect to mysql during Drupal installation
  • docker-compose: using multiple Dockerfiles for multiple services
  • Looking for ways and options to stop the worker process after task completion in celery?
  • Mule 3.7 insufficient memory for JVM
  • Docker Performance Testing
  • Docker on windows server 2012r2
  • It works fine.

    Now I tried to setup this EC2 instances by following this documentation:

    https://docs.docker.com/swarm/install-manual/

    I am in Step 4. Set up a discovery backend

    I cannot understand the steps what I need to do further.

    I created 5 nodes in EC2: manager0, manager1, consul0, node0, node1. Now I need to know how to setup service discovery with swarm.

    In that document they ask us to connect manager0 and consul0 then ifconfig, then they given as etc0 instance. I don’t know where this is coming from.

    Ultimately I need to know where (in which node?) to run this command:

    $ docker run -d -p 8500:8500 --name=consul progrium/consul -server -bootstrap

    Any suggestion for me How to clear this step?

  • docker stop command not working correctly
  • How to run multiple docker container on one mesos slave node?
  • Docker java.lang.RuntimeException when attempting to build error
  • Dockerfile: understanding VOLUME instruction
  • How to get IP address of running docker container
  • Docker container unable to clone from github.com
  • One Solution collect form web for “Need Explanation for the docker documentation on the swarm”

    Consul will run on the consul0 server you created. So basically you first need to be able to run docker on worker0 and worker1 remotely, this is step 3. A better way of doing this is editing the daemon directly with the command:

    sudo echo 'DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"' > /etc/default/docker`
    

    Then restart docker. Afterwards you will find that you can run docker remotely from master0, master1 or any other instance behind your firewall with docker commands that start with:

    docker -H $WORKER0_IPADDRESS:2375 
    

    For example if your workers ip address was 1.2.3.4 this would run the docker ps command remotely:

    docker -H 1.2.3.4:2375 ps
    

    This is what swarm runs on. Then start up your consul server with the command you want to run, you got that one right and thats it you wont do anything else with the consul0 server except use its IP address when you run your swarm commands.

    So if $CONSUL0 represented the IP address of your consul server this is how you would set up the rest of swarm. If you ran each of them on the local machine of each node:

    On consul0:

    docker run -d -p 8500:8500 --restart=unless-stopped --name=consul progrium/consul -server -bootstrap
    

    On master0 and master1:

    docker run --name=master -d -p 4000:4000 swarm manage -H :4000 --replication --advertise $(hostname -i):4000 consul://$CONSUL0:8500
    

    On worker0 and worker1:

    docker run -d --name=worker swarm join --advertise=$(hostname -i):2375 consul://$CONSUL0:8500/
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.