Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ping works but not curl in docker container

I have a docker-compose file w/o any network configuration. My understanding is this creates a default bridge network. From within this network I can run:

 $ ping www.google.com

And it works just fine. But if I try:

$ curl https://www.google.com 

It hangs. If I set network_mode to host then it works, but I can no longer reach other containers in the network. I would prefer to use the default bridge network created but at the moment I'm just trying to do some testing and this isn't for production use. How can I allow access to the internet and access to other containers on the network?

like image 446
Mark J Miller Avatar asked Oct 23 '25 17:10

Mark J Miller


1 Answers

Worked fine on another machine so I rebooted and it worked. I hate when that happens

like image 166
Mark J Miller Avatar answered Oct 26 '25 07:10

Mark J Miller