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. docker container hostname sequential number
  3. Can't access to docker mongo without being root
  4. Permission denied error when using docker import
  5. Issues with Running Flask and SQLAlchemy app through Docker
  6. Docker: container can't find domain on private network
  7. How to handle specific hostname like -h option in Dockerfile
  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.

  • When Docker image push on my linux machine unauthorized: authentication required error display
  • mount a folder in docker machine using docker for mac
  • Does AWS support Kubernetes?
  • what method docker use to give container an ip address?
  • How to upgrade npm to npm@5 on the latest node docker image?
  • Docker on Mac behind proxy that changes ssl certificate
  • 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.