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?
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.
Check which nodes already joined, if any:
docker node lsIf the error is thrown on the worker (not the master) try to leave
docker swarm leaveand then join again.Make sure you have the right
<manager-node-ip>:<port>configuration