skip to Main Content

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.

2

Answers


  1. 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.

    Login or Signup to reply.
  2. We ran into similar issues when using an apache container within a Linux OS. In the dockerfile we are allowing ports 80 and 443 but when running the container we found that instead of mapping ports with -p, we had to use –network host.

    https://docs.docker.com/network/host/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search