0

I created a very simple docker practice script (Github link), and executed it via the docker application on my MAC OS computer without any problems. I wanted to test it on google clouds compute engine, so i created an instance and re-built the docker image & container via the SSH browser (Using Debian GNU/Linux)

Everything seems to work fine, except when i try to access the container via localhost/external IP. Both give me this response Site can't be reached.

I've adjusted the firewall settings many times, and end up with the same results as the screenshot provided. I ended up resetting the firewall settings to its default settings, just so I could bring this question here. Here are the default settings

What makes me think i'm missing something is the fact that I can use curl http://localhost:5000 (the port i've chosen for exposure), and i'll get this as a response, which is all i had set the page to say once it's launched.

What am I missing that's causing the container to not allow me to view it via localhost/external IP?

  • you probably have to bind the port in the container to the host port. this can be done using the `-p` or `--expose` flag in `docker run`. – clemens May 19 '20 at 07:56
  • sorry i shoud've specified - when running it i use "docker run -dp 5000:5000 , and still have no luck – CoryShreffler May 19 '20 at 12:18
  • My hypothesis here is you're not modified the iptables rules on your host to permit connections from Docker containers. Check these two links might help you [1](https://stackoverflow.com/questions/31767314/cant-access-app-deployed-with-docker-and-google-cloud) [2](https://stackoverflow.com/questions/31324981/how-to-access-host-port-from-docker-container). – Milad Tabrizi May 21 '20 at 00:18

0 Answers0