I want my containers in different networks to communicate with each other.
So I created two networks using
docker network create --driver bridge mynetwork1 docker network create --driver bridge mynetwork2
Then I ran two containers on each of these created networks using the commands:
docker run --net=mynetwork1 -it name=mynet1container1 mycontainerimage docker run --net=mynetwork1 -it name=mynet1container2 mycontainerimage docker run --net=mynetwork2 -it name=mynet2container1 mycontainerimage docker run --net=mynetwork2 -it name=mynet2container2 mycontainerimage
I identified the IP Addresses of each of the containers from the networks created using
docker network inspect mynetwork1 docker network inspect mynetwork2
Using those I was able to communicate between the containers in the same network, but I could not communicate between the containers across the networks. Communication was possible only by adding the containers to the same network.
Any possibility to make containers in different networks to communicate?