Machine: docker-machine --swarm-discovery with token does not seem to work?

Created on 27 Sep 2016  路  4Comments  路  Source: docker/machine

What I an trying to do is have both docker manager and docker workers have a pre-selected token they can use so I don't need to docker ssh and run further commands. The docs seem to support that process with the --swarm-discovery flag with a token.

docker run swarm create

Use that token below in the next command:

docker-machine create --swarm-master --swarm --driver virtualbox --swarm-discovery token://b4e72945cb52c1324REDACTED manager2

  1. I can run docker-machine ssh but when I run docker node ls it says 'This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.' and then I need to run docker swarm init.
    However, looking at processes I see this:
    /swarm manage --tlsverify --tlscacert=/var/lib/boot2docker/ca.pem --tlscert=/var/lib/boot2docker/server.pem --tlskey=/var/lib/boot2docker/server-key.pem -H tcp://0.0.0.0:3376 --strategy spread --advertise 192.168.99.100:3376 token://b4e72945cb52c1324REDACTED
  2. The same issue happens when I try to run docker-machine create --swarm --driver virtualbox --swarm-discovery "token://b4e72945cb52c1324REDACTED" worker1 in that it does not automatically join the swarm... I have to ssh and run docker join.

Thus, I don't see the point of the --swarm-discovery flag using the token protocol.

$ docker -v
Docker version 1.12.1, build 6f9534c

$ docker-machine -v
docker-machine version 0.8.1, build 41b3b25

Most helpful comment

You are mixing "classic swarm" (https://github.com/docker/swarm) and "swarm mode" (introduced in 1.12 and bundled into the engine).

To use "classic swarm" you do eval $(docker-machine env --swarm manager). If you want to use the new swarm mode features you have to run init and join commands on the vbox nodes yourself -- thanks

All 4 comments

@ahmetalpbalkan - I think perhaps this is a fix for a different issue?

@pc-mreeves yep my mistake

You are mixing "classic swarm" (https://github.com/docker/swarm) and "swarm mode" (introduced in 1.12 and bundled into the engine).

To use "classic swarm" you do eval $(docker-machine env --swarm manager). If you want to use the new swarm mode features you have to run init and join commands on the vbox nodes yourself -- thanks

@nathanleclaire It took me a long time to find out how to config a swarm mode in using docker-machine. It doesn't seem necessary because the new mode is simple enough thanks your comment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fsoppelsa picture fsoppelsa  路  5Comments

diver-sity picture diver-sity  路  4Comments

BretFisher picture BretFisher  路  5Comments

huseyinbabal picture huseyinbabal  路  4Comments

perj picture perj  路  5Comments