Replica on containers on two hosts

Hi, I have an interesting case, which I failed to sorted-out myself.
On my Host_1, I am running three containers, Node_1, Node_2, Node_3, and MongoDB runs on all of them in Replica. All work great.
Then I wish to extend the replica to Node_4, and Node_5, which should run on Host_2.
Both hosts are in the same network. From both, I can ping each other through IP, so there is connectivity.

So as the next step I log in to Primary on Host_1 and did rs.add(‘192.168.1.4:27020’) to add IP of Node_4 and port. And it doesn’t work. After login to Mongosh on Node_4 the log shows 'no connection to Node_1)…

Please advise, where to look for the answer, or/and it’s something simple which I can’t see now.

Thanks.

It sounds like the mongodb container on host1 is not able to connect to mongo container on host2.

I’m guessing it’s something related to your docker config. Did you verify that the IP “192.168.1.4” is indeed reachable from mongodb container on host1 ? (e.g. ssh to that container and use telnet to test tcp connection to that ip)