docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.62k stars 1.97k forks source link

New command to have an existing machine to join the cluster #1017

Open arun-gupta opened 9 years ago

arun-gupta commented 9 years ago

Per the documentation at http://docs.docker.com/machine/#using-docker-machine-with-docker-swarm, only docker create command can be used to create a node and join the Swarm cluster. There should be an option to have an existing Machine join the swarm cluster as well.

arun-gupta commented 9 years ago

There should also be an option to make an existing machine a Swarm master.

hairyhenderson commented 9 years ago

I think this is totally possible by exposing the configureSwarm function we have in libmachine/provision/utils.go.

I think we could pretty easily have a join command:

# add a couple machines to a cluster
$ docker-machine join --swarm-discovery xxx machine01 machine02
# make machine03 the master of a cluster
$ docker-machine join --swarm-master --swarm-discovery xxx machine03

One question on the second part: what happens if the cluster already has a master that docker-machine knows about?

arun-gupta commented 9 years ago

Only one master is permitted per cluster at this time so that should result in an error message. When multiple (redundant) masters are allowed then should be allowed to be added.

sundarseswaran commented 9 years ago

I think this feature is mandatory, just encountered a need for this and found this issue here.

BTW, what happens if the node that acts as the swarm-master goes down? Can any other node in the cluster become a swarm-master instantaneously using the same discovery token?

nathanleclaire commented 9 years ago

In general I am moving towards having some sort of docker-machine apply command which would re-apply configuration for all things. E.g. engine options, swarm settings, TLS, and so on.

charlesg3 commented 9 years ago

+1