I have the following setup…
Public DNS entry to point to a digital ocean droplet, lets call it
On the DO droplet, docker is running with a docker compose file with multiple services
The docker compose file is using the default bridge network
One service, lets call it service A, in the compose file handles http/https traffic (ports 80, 443)
Service B needs to do http(s) requests to service A and uses the public DNS
foo.comas the host when performing these requests because I don’t want B to depend on A running on the same docker host and network. B and A will most likely end up on separate hosts/networks down the road.
From container B, when I do
curl http://foo.com the request just times out.
ping foo.com from inside B correctly resolves to the docker host IP address (the DO droplet) and the pings return.
My expectation for the curl request is that DNS would resolve to the docker host IP address, send the request there, which should then be be handled by the docker client and handed off to service A because ports 80, 443 are exposed.
curl http://foo.com from the docker host or any other computer connected to the internet works correctly and requests are routed to service A. Why will this simple request not work from within the containers?