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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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