You shouldn’t need Nginx service to make the overlay network available on all nodes when you are working on swarm mode. On swarm mode by default, all nodes use the routing mesh which does that for you and any swarm service you create will be attached to the overlay
ingress network if you do not connect it to a user-defined overlay network. See: https://docs.docker.com/network/overlay/
The routing mesh enables each node in the swarm to accept connections on published ports for any service running in the swarm, even if there’s no task running on the node. The routing mesh routes all incoming requests to published ports on available nodes to an active container.
--publish flag to publish a port when you create a service.
target is used to specify the port inside the container, and
published is used to specify the port to bind on the routing mesh.
To do so, you should create the service using
docker service create:
$ docker service create \
--name <SERVICE-NAME> \
--publish published=<PUBLISHED-PORT>,target=<CONTAINER-PORT> \
This will create your services inside the swarm and attach them to the overlay network
ingress, but you can also specify other overlay networks. Although, I would not create containers outside the swarm using the same overlay network if there isn’t a good reason for it. Did you tried to deploy these 2 containers inside the swarm (one on the worker node and other on the manager node) and then ping between them? You can use placement constraints for that.
I would also check that any extra port you open (apart from the ones reserved for the swarm) has proper security rules. For example, if you want to ping, you will need to allow any ICMP connection on your Windows and Ubuntu VM.
If it doesn’t work, I would check towards the network policies and system used to run the VMs. Some virtual machines use the port 4789 or other swarm ports and blocked the embedded VMs as a result. If it is the case you can do something like this to change the swarm port:
docker swarm init < MANAGER-IP > --data-path-port 5789
Even though, it seems you are using a VM machine and Desktop PC to create 2 nodes on the same Desktop PC. Did you consider to use different docker machines instead?
docker-machine create node1
docker-machine create node2
docker-machine ssh node1
docker-machine ssh node2