Ping between 2 containers in 2 different VM machines

Hi,
I read that you can communicate with containers that are in the same host. My question is: Can you communicate (just do a ping) 2 containers that are in to different VMs?

If you create swarm services in the same overlay network, then yes!

1 Like

Hello, thanks for your anwer. I have done the following:

VDI 1:
-docker swarm init
Swarm initialized: current node (m4loyvrbz2ka896nx6ijmzodf) is now a manager
To add a worker to this swarm, run the following command:

docker swarm join --token SWMTKN-1-01fl0q53yjd1xyax8hd00nmwwchpnwgtqem37d9igudi1f23rf-201ozylq8j9hq7mlck3d5rhgi 10.111.2.2:2377

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

-docker network create -d overlay --attachable myattachable-overlay
ig93br99re5hyseexbxwil62s

VDI 2:
-docker swarm init
docker swarm join --token SWMTKN-1-01fl0q53yjd1xyax8hd00nmwwchpnwgtqem37d9igudi1f23rf-201ozylq8j9hq7mlck3d5rhgi 10.111.2.2:2377
This node joined a swarm as a worker.

Is still cannot make ping? Am I misisng something?