Docker swarm manager cannot recognize swarm nodes

I follow these steps to create Docker swarm cluster.

  1. create Cunsol
    $ docker-machine create -d virtualbox mh-keystore
    $ eval “$(docker-machine env mh-keystore)”
    $ docker run -d \
    -p “8500:8500” \
    -h “consul” \
    progrium/consul -server -bootstrap

  2. MupX, graphicsmagick and env var
  3. Docker image size not matching the container size after a commit
  4. add hosts redirection in docker
  5. How do I get Apache and tomcat docker containers to talk to each other?
  6. Dockerfile unable to resolve host github with “go get”
  7. Jenkins pipeline groovy string compare
  8. create swarm manager
    $ docker-machine create -d virtualbox node1
    $ docker run -d -p 4000:4000 swarm manage -H :4000 –replication — advertise $(docker-machine ip node1):4000 consul://$(docker-machine ip mh-keystore):8500

  9. create swarm node
    $ docker-machine create -d virtualbox node2
    $ docker run -d swarm join –advertise=$(docker-machine ip node2):2375 consul://$(docker-machine ip mh-keystore):8500

  10. login node1
    $ docker-machine ssh node1
    $ docker -H :4000 info

But this instruction output

(unknown): ip)
└ ID:
└ Status: Pending
└ Containers: 0
└ Reserved CPUs: 0 / 0
└ Reserved Memory: 0 B / 0 B
└ Labels:
└ Error: Cannot connect to the Docker daemon. Is the docker daemon running on this host?….

How can I fix this ?
I have already check node2 and it run well.

[Update] I follow this page and it works well. But I still wan’t to know how set up swarm cluster without docker-machine.

[Update] Another approach doen’t work either.

docker-machine create -d virtualbox \
    --swarm \
    --swarm-discovery="consul://$(docker-machine ip mh-keystore):8500" \
    --engine-opt="cluster-store=consul://$(docker-machine ip mh-keystore):8500" \
    --engine-opt="cluster-advertise=eth1:2376" \

Node1 docker info appear mhs-demo1 ip but info still unknown..

when I type eval $(docker-machine env –swarm node1)
It show

Error checking TLS connection: “node1” is not a swarm master. The
–swarm flag is intended for use with swarm masters Does this cause error ? Why using swarm manager instruction to set up is not swarm

It’s so strange. How can I get the same result as

docker-machine create \ -d virtualbox \ --swarm --swarm-master \ --swarm-discovery="consul://$(docker-machine ip mh-keystore):8500" \ --engine-opt="cluster-store=consul://$(docker-machine ip mh-keystore):8500" \ --engine-opt="cluster-advertise=eth1:2376" \ mhs-demo0

using swarm instruction?

I want to use swarm instruction because I don’t want to declare swarm master when I create it.

  • How to update /etc/hosts file in Docker image during “docker build”
  • Docker volume not mounting in the Ubuntu container from Windows host
  • How can I install docker on Debian 8 kernel 2.6.32
  • docker - installing java 8 with curl
  • Is “args” in Mesosphere equivalent with environment variables in docker run command?
  • How debug Dockerfile which runs on one platform but not another
  • 3 Solutions collect form web for “Docker swarm manager cannot recognize swarm nodes”

    Why are you using docker-machine just to start a node? You can use docker machine to setup your node with swarm ready to go..
    You can follow this tutorial

    Try deleting this file with:

    sudo rm /etc/docker/key.json

    Then restart docker with:

    sudo service docker restart

    At this point docker will make a new key.json file and your master should be able to find your workers. This happens sometimes when you use the same image for all your worker nodes, but its an easy fix.

    In docker 1.12 swarm mode is directly available. There is no need for a key value store for the cluster.

    just follow the this :

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.