Can not connect nodes to docker swarm master (using zookeeper)

I am building my docker swarm cluster in a sandbox.
I have 1 zookeeper on a machine for discovery, 1 swarm master and 2 swarm nodes.
I try to connect them but when I try to run my docker run commands on the swarm master, it does not distribute the work to the nodes.
Also when I do docker info on the swarm master I can see that the nodes are not connected.
I do not know what I am doing wrong.
Here are the step to reproduce my problem:

I have an empty pwd/data folder and a pwd/config folder with my zoo.cfg:

  • Is docker phasing out some sites and services or something?
  • Secure Docker Daemon with wild card domain certificate
  • Certificate error in docker
  • Accessing docker container mysql databases
  • Is Docker Swarm using multiple cores on same machine
  • Docker - How can i find running container?
  • tickTime=2000

    #---- CREATE ZOO ---
    docker-machine create --driver virtualbox zoo1
    docker-machine start zoo1
    eval $(docker-machine env zoo1)
    docker pull jplock/zookeeper
    docker run -p 2181:2181 -v `pwd`/conf:/opt/zookeeper/conf -v `pwd`/data:/tmp/zookeeper jplock/zookeeper
    docker-machine ip zoo1 #############

    #--- CREATE CLUSTER ---
    docker-machine create --driver virtualbox --swarm --swarm-master machine-smaster
    docker-machine create --driver virtualbox --swarm machine-s01
    docker-machine create --driver virtualbox --swarm machine-s02

    eval "$(docker-machine env machine-smaster)"
    docker run -p 2375:2375 -d -t swarm manage -H --advertise $(docker-machine ip machine-smaster):2375 zk://
    docker run swarm list zk://
    sleep 10
    eval "$(docker-machine env machine-s01)"
    docker run -d swarm join --advertise $(docker-machine ip machine-s01):2375 zk://
    docker run swarm list zk://
    eval "$(docker-machine env machine-s02)"
    docker run -d swarm join --advertise $(docker-machine ip machine-s02):2375 zk://
    docker run swarm list zk://

    If I run some containers:

    eval "$(docker-machine env machine-smaster)"
    docker run hello-world

    The work is not dispatched to nodes (it is run by the master).
    If I run docker info:

    eval "$(docker-machine env machine-smaster)"
    docker info

    I do not see the swarm nodes.

  • X509 parsing error, 'negative serial number' while pulling repository
  • Howto persist MongoDB - data of a running Docker container in a new image?
  • Is it possible to add multiple source files in dokker.json?
  • How do you iteratively develop with docker?
  • AWS ElasticBeanstalk can't find Dockerfile
  • Setting up multiple Docker containers and MongoDB to run in CircleCI
  • 2 Solutions collect form web for “Can not connect nodes to docker swarm master (using zookeeper)”

    Can you verify that the addresses you’re advertising are actually reachable from the manager instance? i.e., does docker -H $(docker-machine ip machine-s01):2375 info return a valid result?

    (Note that this subshell won’t work inside the manager VM, just on your original client.)

    Maybe your problem is that the started Docker Machine instances are listening on :2376 with TLS, but your started Swarm containers are trying to advertise and connect to :2375 without any TLS settings specified?

    What do the docker logs for the Swarm containers say?

    It looks like you’re connecting to the “Swarm master” machine through the Docker API, not the Swarm API. Because of this, Docker will always deploy containers on the host you’re connected to, and does not take advantage of Swarm scheduling the containers on the right host.

    To connect to the Swarm API, add the --swarm option when running docker-machine env, so in your case:

    eval "$(docker-machine env --swarm machine-smaster)"
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.