sudhir tataraju
sudhir tataraju

Reputation: 1389

How to join another physical server or VM as a node for a docker swarm machine?

Hi I have docker swarm in a physical server1, the docker worker join token command generated with a dummy IP, now I want to make another physical server2 in which docker installed as a worker node to docker swarm in physical server1.

So I cannot run the worker join token command as its has dummy IP of the manager node which physical server2 cannot reach.

I have connectivity between server1 and server2 though.

So how to handle this ?

Upvotes: 0

Views: 929

Answers (2)

Raman
Raman

Reputation: 11

The dummy IP will generate only when you have not mentioned your physical machine IP as your swarm API IP at the time of creating or initializing the docker swarm.... If you give your machine IP as swarm API server IP at the time of initializing the swarm cluster at master node by specifying the --advertice-addr=<IP of ur master node IP>
So this IP can use other VMs to join as worker nodes in your cluster..

Note: your IPs in same subnet.

Upvotes: 1

You need to re-configure the advertisement address of Docker swarm manager. If the first machine is not a real production machine or you can deploy the code whenever you want, you can call easily the following command on the manager machine to re-initialize the docker swarm service with own new advertisement address.

$ docker swarm leave --force; \
docker swarm init --advertise-addr=<Server IP>

Then you can generate the worker token with 'join-token' command again:

$ docker swarm join-token worker

Please keep mind that the stack you deployed before is gonna be disappeared after you called docker swarm leave --force.

OR

You need to find a way to change the advertisement address.

Regards.

Upvotes: 1

Related Questions