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
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./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
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
@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.
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 runinit
andjoin
commands on the vbox nodes yourself -- thanks