Docker Container No route to host error

I have the following docker:

docker --version
Docker version 17.12.0-ce, build c97c6d6

And when I do a CURL to an external URL, it fails:

inside-container$> curl -u username -p https://countries.c1.com/countries/v1/countries
curl: (7) Failed to connect to 10.10.20.30 port 443: No route to host

inside-container$> ping countries.c1.com

PING countries.c1.com (10.10.20.30): 56 data bytes
64 bytes from 10.10.20.30: icmp_seq=0 ttl=250 time=2.919 ms
countries.c1.com ping statistics —
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.919/2.919/2.919/0.000 ms

So host can be resolved but can’t do a curl or telnet. When I run the same curl statement from outside of the docker container (e.g docker host or laptop) it works fine!

Any hint pointing me to the right direction would be very much appreciated!

I am not sure what kind of configuration might be relevant. I will provide anything later on if requested.

1 Like

I have a similar problem when running wp-super-cache plugin on WordPress using Docker for Mac. The cURL calls from wp-super-cache from inside my WordPress container to http://localhost:8081 (I am mapping ports using -p 8081:80) are failing.

There are many other posts on this problem on this forum. This is the one I got most info from:

And this is the official documentation on workarounds for the issue as far as I can see. In my case, as the call is being made from a third party plugin, I may have to hack it to update the address the cURL command uses. I will see if I can make it work.

Hi saffik

Any luck working this out? I have the same issue. Using Docker for Windows 10 and trying to reach a registry running as a VM on another host.

Thanks