user6420577
user6420577

Reputation: 225

Docker swarm cluster how to add manager nodes as a reachable

I am using docker virtual box for windows 7 machine.

$ docker-machine ls

NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default * virtualbox Running tcp://1.2.3.101:2376 v17.04.0-ce manager1 - virtualbox Running tcp://1.2.3.106:2376 v17.04.0-ce manager2 - virtualbox Running tcp://1.2.3.105:2376 v17.04.0-ce worker1 - virtualbox Running tcp://1.2.3.102:2376 v17.04.0-ce worker2 - virtualbox Running tcp://1.2.3.104:2376 v17.04.0-ce worker3 - virtualbox Running tcp://1.2.3.103:2376 v17.04.0-ce

$ docker node ls

ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS e8kum3w0xqd4g02cx1tfps9ni manager1 Down Active aibbgvqtiv9bhzbs8l20lbx2m * default Ready Active Leader sbt75u8ayvf7lqj7y3zppjwvk worker1 Ready Active ny2j5556w4tyflf3tjfqzjrte worker2 Ready Active veipdd0qs2gjnogftxvr1kfhq worker3 Ready Active

Now i am planing set up environment docker swarm cluster, like i have three manager node (name as default,manager1,manager2) and three workers nodes (name as worker1, worker2,worker3).

Using default manager node i init docker swarm with address

$ docker swarm init --advertise-addr 1.2.3.101:2376

output starting

Swarm initialized: current node (acbbgvqtiv6bhzbs8l20lbx1e) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join --token SWMTKN-1-1ie1b420bhs452ubt4iy01brfc97801q0ya608spbt0fnuzkp0-1h2a86acczxe4qta164np487r 1.2.3.101:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

output ending

Using this output i easily added worker nodes. Now my question is how yo add other manager (manager1,manager2) to reachable state. Note still default node act as leader

could you please any one help on this ?

Thanks

Upvotes: 1

Views: 2544

Answers (2)

varkashy
varkashy

Reputation: 385

Run command on manager node docker swarm join-token manager to get the token to add other nodes as manager, should be similar to the worker token you got above You need to ssh to the other machine which you want to add as a manager node to the swarm. Once done, run that command

For the manager to advertise address you can provide --advertise-addr and --listen-addr flags as well, they take host:port as param. Hope this helps

Upvotes: 1

user3873265
user3873265

Reputation: 86

Sorry for late answer.

On the existing manager host get manager-token:

>docker swarm join-token manager

and then on a potential manager host execute got output

Upvotes: 1

Related Questions