Question

Connect To Own Machine within docker

Hey, I got a quite weird problem with a docker container on a droplet.

The container runs a webserver with php. When I want to get a file via http (by the public url, not by “localhost”) I always run into timeouts.

For example: wget http://dogvers.flarandr.de/wp-json/ens/v1/zipcity/12163 never returns something. When I retreave the URL inside my Browser its works fine. The DNS resolution also seems to woks perfectly.

I Also tried to establish a telnet connection to port 80. It works from outside, but not from inside the container.

traceroute (from inside the container) returns the following:

traceroute to 167.71.53.86 (167.71.53.86), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
[... and so on]

So its not very helpful.

I use the exact same image on another machine (not digitalocean) an there it works.

Do you have any ideas to fix this?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
August 21, 2022

Hi there,

I’ve just tested this and I was able to run the wget command from my Droplet.

Are you running the command on the same Droplet that the container is running on?

If this is the case, it sounds like that you might have a firewall which is blocking the outgoing TCP connections on port 80. Can you verify if this is the case? If this is the case, you would just need to open port 80 for outgoing TCP connections for that Droplet and it should work as expected.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel