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?
I think the idea (at least today) is that if you want two containers to be able to communicate, you should put them on the same network.
Why do you want containers on different networks to be able to communicate? One container can actually belong to multiple networks, so if you wanted containers A, B, and C where A <=> B and B <=> C but A and C cannot communicate, you could do so (Either using Compose’s networks key for services or by executing extra docker network connect commands after docker run).
Hey I read everywhere that to comunicate 2 containers have to be in the same network, and it give me a problem.
I have a docker on a server and I want to make it comunicate with an other server where are some apis in container or out so my question is is it possible to make them comunicate ?
In a practical way I have kong inside a container and I want to add api from other servers so is it possible in the case of non-dockerized api and in the case of dokerized one ?
My issue is if 2 container have to be part of the same docker network to comunicate how can I make containers on different physical server to comunicate
Hi Niradnik,
you can create an overlay network interface for communication between two containers which are located on different physical servers.
but you also need to “docker swarm init” for doing that. i hope this work for you.
Thanks