I have the setup as shown in the above image. In the System 1, I have created the containers with Option net=host, and when I am running a Single Container with the above architecture, then I am getting accurate output. But when I am running both the containers at the same instance, then both the containers are not getting proper data so I am unable to achieve the proper results. So, requesting help in this regards
Can anyone help here
Help with what? The main reason for not getting any response is the lack of details in the descriptions that help to understand the exact situation. We know nothing except that the containers use the host network.
If the containers use the host network, then it means they are not isolated from the host network namespace, and behave network-wise like any native process on the host.
Thus said, the two contains should network-wise behave like as if they run directly on the host.
i am unable to receive data in both the containers simultaneously, but if i run any single container at one instance, then the data is coming properly. But when 2 containers are run simultaneously, none of the container receives data
Which instance is sending and receiving data to/from which other instance? If you run two containers on the same node with host networking and listen for incoming data, make sure to use different a different port for each.
And you don’t need generic host networking, just declare the specific port to be opened on the node:
docker run --name c1 -p 10001:80 ...
docker run --name c2 -p 10002:80 ...
docker run --name c3 -p 10003:80 ...
i am using vsomeip communication protocol, which communicates on port 30490, so can both the containers be exposed to the same port ?
No, on host you need to use different ports. Inside container you can use the same.
On the server running multiple instances, you need to map different external ports to the internal ports of the containers.
This information should have been part of the first post. A port on an ip can be bound by exactly one single process, regardless whether it runs inside a container or directly on the host.
If your application requires a fixed port for inbound communication, then you won’t be able to run this application more than once (again: regardless whether the process runs inside a container or directly on the host).
Tried with only one container whose port 30490 is exposed to host’s port 30490, still it doesnt work [container ip is in the range of 172.17 …] but whereas if i create a container with net=host , things do work like vsomeip communication happens
Even if it would work with published port, you still can only have one container publishing to the host port.
IF you publish a port you must make sure to publish a port for the right protocol. If you don’t specify anything, the tcp protocol will be used by default…