Number of nodes appears 0 in a swarm cluster

315 views Asked by At

Hello I created the swarm cluster in the following way

On my workstation:

$docker pull swarm
$docker run --rm swarm create

On another docker host

docker run -d swarm join --addr=nodeIP:2375token://cluster_id_from_step_2

Back on workstation

docker run -d -p 8333:2375 swarm manage token://cluster_id

If I list the nodes running on that cluster by running the following command on my workstation I see the nodeIP But if I run the following command

sudo docker -H tcp://workstationIP:8333 info
Containers: 0
Images: 0
Role: primary
Strategy: spread
Filters: affinity, health, constraint, port, dependency
Nodes: 0
CPUs: 0
Total Memory: 0 B

Why dont I see the node IP in the nodes?

Note: This set up is running in a private network in vagrant based off virtualBox

The vagrantfile

Vagrant.configure(2) do |config|
 config.vm.box = "phusion/ubuntu-14.04-amd64"
 config.vm.hostname = "docker-test-machine"
 config.vm.network "private_network", type: "dhcp"
 config.vm.network "forwarded_port", guest: 80, host: 80


 config.ssh.forward_agent = true

 config.vm.synced_folder "H:\\home_folder", "/home_folder"
 config.vm.provider "virtualbox" do |vb|
  vb.memory = 2048
  vb.cpus = 4
end

 config.vm.provision "shell", inline: <<-SCRIPT
    ## install docker
    if ! type docker >/dev/null; then
      echo "installing Docker"
      curl -sL https://get.docker.io/ | sh
      curl -sL https://raw.githubusercontent.com/dotcloud/docker/master/contrib/completion/bash/docker > /etc/bash_completion.d/docker
      adduser vagrant docker
    else
      echo "upgrading Docker"
      apt-get update
      apt-get -y install lxc-docker
    fi

  SCRIPT
end
1

There are 1 answers

1
dnozay On

After you did:

docker run -d -p 8333:2375 swarm manage token://cluster_id

... your swarm manager is on port 8333 not 2375; you would need to query the swarm manager with:

docker -H tcp://workstationIP:8333 info