How to use Docker swarm mode in WSL 2

239 views Asked by At

I am trying to use WSL 2 to do hands-on experiments on Docker swarm mode. However, when I use docker swarm init, it initializes the current node as the manager and provides a token to join worker. However, when I am trying to use the command to join worker, it is throwing an error as:

Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.

How can I configure WSL 2 to use Docker swarm mode?

1

There are 1 answers

1
Jannik Sinz On

Where are you using the join command to join the cluster? Are you using it on another WSL instance? You obviously cannot join the master from the master machine.

  1. Check which nodes already joined, if any: docker node ls

  2. If the error is thrown on the worker (not the master) try to leave docker swarm leave and then join again.

  3. Make sure you have the right <manager-node-ip>:<port> configuration