My HOST server and PBX Server are on the same LAN. Host server pings SIP server and vice versa.
My application which was on host server is moved to docker container now…
Now, am not able to make a connection from docker container application to the PBX sip server.
This is because the request generated from Docker container application contains the IP of the Docker container and not of the host server. We can port forward to the host layer but IP cannot change… SIP server is not able to ping the docker container
Sounds like you are not publishing the application’s listening port when you start the application’s container so the port is not available outside of Docker and the Application Docker container.
Check here for details -> https://docs.docker.com/config/containers/container-networking/
Port is exposed properly from the container, issue is with the IP …
i am exposing the port in my container and also forwarding the port to host as well. But the problem is with the IP… the SIP connection which i need is peer to peer . the SIP request packet which is forwarded from container to its host to the PBX SIP server contains the IP of the container and not the IP of the host. We cannot tamper the SIP request packet… So when PBX SIP server recieves the request and wants to ping back , it cannot understand the IP of the container and no communication here…
Yeah little naive here … can you share some examples where i can use the host network while connection… I did some example but could not understand what type of driver should i use when i create the docker network … will it be “overlay” or something else which we can communicate with the Host IP address rather and Host network devices.,
would really appreciate if you share some good content or examples …
Will try out those and will keep posted on my updates…
Sounds like you are using Docker Swarm. You did not elaborate.
Here’s an example with a Swarm docker-compose file Version 3.6 of running an Apache web server which is listening on port 80 in a docker container with host networking. No need to publish the port.
Thanks so much for directing me to the correct usage of docker network. I am able to solve my issue by creating a “macvlan” driver for my docker network. I needed to give the Gateway of my host unix shell and by this way …my docker container can ping back any device which is on the HOST lan and ping is vice versa. The most important thing to take care is Allowing the Promiscuous mode on the host machine.