Need Explanation for the docker documentation on the swarm

I finished this documentation:

  • How can I copy the files to be in executing directory using Dockerfile?
  • Source code changes in kubernetes, SaltStack & Docker in production and locally
  • Docker “ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network”
  • Managing and Utilizing Multiple Docker Containers (Microservices) in a Single Server
  • Publishing a message to Kafka running inside docker
  • Can't run HMA OpenVPN in Docker [closed]
  • It works fine.

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

    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?

  • Is it possible to get host details from within docker container?
  • error in docker build publish plugin
  • File as command line argument of Docker python app
  • Why do Spring Cloud Netflix applications deployed on Docker containers require explicitly setting eureka.instance.hostname?
  • How to prevent Docker from re-running pip installs every time I modify code [duplicate]
  • Converting standard LAMP installation to Docker?
  • 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:// -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 this would run the docker ps command remotely:

    docker -H 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.