Docker host and containers in same network

In the image attached in this question
J - Jetty
P - Postgres
Scenario: I want to communicate between two jetty containers which means from jett1 container i should be able to ping jetty2 container. Where each jetty containers will have postgres and also i need to ping that containers from host machine. All these containers should be in host network.

Thanks in advance.

Enable container host network and make sure to use a different listening port for each instance.

1 Like

can you elaborate it.

Host network means no network isolation, meaning no container IP so there is nothing to ping.

1 Like