Docker Community Forums

Share and learn in the Docker community.

Getting started with swarm mode - "address already in use" with docker-machine

virtualbox

(Bluepuma77) #1

I am running around in circles, trying to get docker-machine to work with Swarm.

The tutorial is easy: "Three networked host machines; Docker Engine 1.12 or later"

Those I create with docker-machine, virtualbox and docker engine v1.12.0-rc4.

docker-machine create --driver virtualbox --virtualbox-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.12.0-rc4/boot2docker.iso manager1 docker-machine create --driver virtualbox --virtualbox-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.12.0-rc4/boot2docker.iso worker1 docker-machine create --driver virtualbox --virtualbox-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.12.0-rc4/boot2docker.iso worker2

I then get the IP of the manager for swarm init via docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS manager1 - virtualbox Running tcp://192.168.99.105:2376 v1.12.0-rc4 worker1 - virtualbox Running tcp://192.168.99.106:2376 v1.12.0-rc4 worker2 - virtualbox Running tcp://192.168.99.107:2376 v1.12.0-rc4

But I can’t init the swarm according to the tutorial, bcause docker is already using the port.

docker-machine ssh manager1 docker swarm init --listen-addr 192.168.99.105:2376 No --secret provided. Generated random secret: e7oz6gsxjl1c73gwh34a4vhnj Error response from daemon: listen tcp 192.168.99.105:2376: bind: address already in use exit status 1

What am I doing wrong? I don’ get it, shouldn’t docker-machine work together with docker swarm? Especially now that the great swarm features are integrated for easiest scaling, I don’t want to provision and SSH into every instance by myself but use docker-machine to set everything up.

It would be great to extend the new docker swarm tutorial to include docker-machine and let the two tools work together seamlessly.


(Bluepuma77) #3

My mistake, port 2376 is for the regular docker service, for swarm you should use 2377.

docker-machine ssh manager1 docker swarm init --listen-addr 192.168.99.105:2377