Search code examples
dockernetwork-programmingdocker-network

docker container unable to call apache server installed on host OS


I have an Ubuntu server that is running a centOS 7 docker container. This centOS container has apache running on ports 80 and 443 which are bound to the same ports of the host OS. This centOS container has another container inside of it and this nested container needs to call an API that is hosted by the Apache server at the outer container. When the nested container calls the API using the curl command it gives a timeout error. curl -k https://<public IP of host OS>

However, the nested container is able to ping the host OS using its public IP. Also, ssh to host OS works from the nested container using this command ssh root@<public IP of host OS>.

enter image description here

Also, the nested container can access all the websites on the internet.


Solution

  • If you can ping, ssh but not http(s) the host, check the firewall for http(s) on the host OS. Especially the timeout is a hint for that.