How to fix docker swarm issues on registrator

This is for only who watched and tried this below pluralsight course.

https://app.pluralsight.com/library/courses/docker-swarm-native-docker-clustering

  • systemctl from inside docker container fails with D-Bus connection error
  • Docker and Angular app: one or two containers?
  • Need to know how to use Groovy to automate a Docker build & runtime
  • Golang docker library image cannot find go tool in $PATH
  • Push a Docker Compose to a Production Server
  • Setting up a pycharm license server
  • If any body gone though this please tell me what I am missing

    Setup Consul Cluster On manger
    Manger 1

    docker -H tcp://mgr1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul1 --name consul1 -v /mnt:/data -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 53:53 progrium/consul -server -advertise mgr1-IP -bootstrap-expect 3
    

    Manger 2

    docker -H tcp://mgr2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul2 --name consul2 -v /mnt:/data -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 53:53 progrium/consul -server -advertise mgr2-IP -join mgr1-IP
    

    Manger 3

    docker -H tcp://mgr3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul3 --name consul3 -v /mnt:/data -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 53:53 progrium/consul -server -advertise mgr3-IP -join mgr1-IP
    

    Setup Swarm On manger
    Manger 1

    docker -H tcp://mgr1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -h mgr1 --name mgr1 -d -p 3376:2376 -v /home/ubuntu/.docker:/certs:ro swarm manage --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/cert.pem --tlskey=/certs/key.pem --host=0.0.0.0:2376 --replication --advertise mgr1-IP:2376 consul://mgr1-IP:8500/
    

    Manger 2

    docker -H tcp://mgr2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -h mgr2 --name mgr2 -d -p 3376:2376 -v /home/ubuntu/.docker:/certs:ro swarm manage --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/cert.pem --tlskey=/certs/key.pem --host=0.0.0.0:2376 --replication --advertise mgr2-IP:2376 consul://mgr2-IP:8500/
    

    Manger 3

    docker -H tcp://mgr3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -h mgr3 --name mgr3 -d -p 3376:2376 -v /home/ubuntu/.docker:/certs:ro swarm manage --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/cert.pem --tlskey=/certs/key.pem --host=0.0.0.0:2376 --replication --advertise mgr3-IP:2376 consul://mgr3-IP:8500/
    

    Setup consul slaves

    Node 1

    docker -H tcp://node1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul-agt1 --name consul-agt1 -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:8600/udp progrium/consul -rejoin -advertise node1-IP -join mgr1-IP
    

    Node 2

    docker -H tcp://node2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul-agt2 --name consul-agt2 -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:8600/udp progrium/consul -rejoin -advertise node2-IP -join mgr1-IP
    

    Node 3

    docker -H tcp://node3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul-agt3 --name consul-agt3 -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:8600/udp progrium/consul -rejoin -advertise node3-IP -join mgr1-IP
    

    Setup swarm slaves

    Node 1

    docker -H tcp://node1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d -h join --name join swarm join --advertise=node1-IP:2376 consul://node1-IP:8500/
    

    Node 2

    docker -H tcp://node2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d -h join --name join swarm join --advertise=node2-IP:2376 consul://node2-IP:8500/
    

    Node 3

    docker -H tcp://node3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d -h join --name join swarm join --advertise=node3-IP:2376 consul://node3-IP:8500/
    

    Setup RegistratorIn All Machines

    Manger 1

    docker -H tcp://mgr1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
    

    Manger 2

    docker -H tcp://mgr2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
    

    Manger 3

    docker -H tcp://mgr3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
    

    Node 1

    docker -H tcp://node1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
    

    Node 2

    docker -H tcp://node2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
    

    Node 3

    docker -H tcp://node3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
    

    I am facing 2 problems ,

    1. The registrator container not starting

      docker -H tcp://mgr1-IP:2376 –tlsverify –tlscacert=/home/ubuntu/.docker/ca.pem –tlscert=/home/ubuntu/.docker/cert.pem –tlskey=/home/ubuntu/.docker/key.pem logs reg

      2016/05/08 06:14:25 Starting registrator v7 …

      2016/05/08 06:14:25 Using consul adapter: consul://mgr1-IP:8500/

      2016/05/08 06:14:25 Connecting to backend (0/0)

      2016/05/08 06:14:25 consul: current leader mgr2-IP:8300

      2016/05/08 06:14:25 Listening for Docker events …

      2016/05/08 06:14:25 cannot connect to Docker endpoint

    2. After connecting to the client If I run some container , It is executing on current leader manger machine it self. not in the nodes.

    How to fix this two issues?

  • docker container hanging when run dotnet new
  • Docker compose share environment variables
  • Install MongoDB and Tomcat using Dockerfile
  • How deploy spring cloud data flow on docker
  • How to stop all containers when one container stops with docker-compose?
  • Docker in a Parallels' Virtual Windows 10 Pro Machine
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.