Can not join Node to Master by Docker desktop

Docker Desktop is running on two physical machines. One is the master and once is the node in swarm mode.
Step 1: Init swarm on Master:

docker swarm init --advertise-addr --listen-addr

  • Result:
`docker swarm join --token SWMTKN-1-19usewy41ourkf7n9ykcz74typzv8pripgyty4rces2iwu25mm-60usnt70eyq3x2ct0rpm0bakb`

Step 2: join node to master:

docker swarm join --token SWMTKN-1-19usewy41ourkf7n9ykcz74typzv8pripgyty4rces2iwu25mm-60usnt70eyq3x2ct0rpm0bakb

  • Result:
Swarm: error
  Error: rpc error: code = DeadlineExceeded desc = context deadline exceeded
  Is Manager: false

The firewall is turned off and two machines are on a LAN.
Run the command on the master node. But there is not any service running on port 2377:

telnet 2377


Connecting To not open connection to the host, on port 2377: Connect failed

Please show me how to join a node to the master node in the Docker swarm?

This is the address other nodes call. So using localhost there probably is not the best idea unless you don’t want any other node to join this master node.

Update: Since you are using Docker Desktop I would assume you need --advertise-addr to use the host ip address AND make sure to forward the port from the host to the WSL2 distribution. By default ports of a WSL2 Distribution are only bound to localhost, but not any host ip!