Worker unable to connect to Docker swarm Manager

I have setup the docker swarm manager in one machine with IP 192.168.XXX.XXX by using this command :

docker swarm init --advertise-addr=192.168.XXX.XXX and I got this message :

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

docker swarm join --token SWMTKN-1- 
0jpgak7bm7t4mzluz48gdub06f5036q8yaoo99awkjmlz48vtb- 
1eutz0k1vp37ztmiuxdnglka2 192.168.XXX.XXX:2377

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

In other machine I tried the following command :

docker swarm join --token SWMTKN-1- 
0jpgak7bm7t4mzluz48gdub06f5036q8yaoo99awkjmlz48vtb- 
1eutz0k1vp37ztmiuxdnglka2 192.168.XXX.XXX:2377

and the result was :

error response from daemon : rpc error : code = Unavailable desc = all 
SubConns are in TransientFailure, latest connection error: connection error 
: desc = "transport: Error while dialing dial tcp 192.168.XXX.XXX:2377 : 
connect: connection refused 

Docker version :

Client: Docker Engine - Community
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:47:51 2018
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:55:00 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Furthermore, I verified by netstat that port is not listening.

Not that this will help you, but I just ran into the very same when going through the docker tutorial. Any wisdom on this, yet?
(Hopefully adding a reply moves this to the front of the list again, so we may have a higher chance of someone looking and responding…).

Firewall blocking the swarm connections?

The following ports must be available. On some systems, these ports are open by default.

    TCP port 2377 for cluster management communications
    TCP and UDP port 7946 for communication among nodes
    UDP port 4789 for overlay network traffic

If you plan on creating an overlay network with encryption (--opt encrypted), you also need to ensure ip protocol 50 (ESP) traffic is allowed.

Thanks for responding! As turned out I had misunderstood the command line arguments and thought, that I need to adjust the trailing IP to match the one of the node that the VM is running on (that of “myvm2” in my case). However, as I later realized, this has to be the IP of the node that the swarm manager runs on (here that of “myvm1” - which of course makes sense - in retrospect…). I.e. one has to enter the line that gets emmited at the end of the swarm init command as-is (except for the port number).
Problem solved!

Awesome. Glad you got it working.