1

I'm currently trying to run my application on production with docker on a VPS with Ubuntu 22 installed.

But I can't access the application, every time I get a timeout on the port that I've set.

So I tried the most simple docker image to test what going wrong and even the simple nginx image gives me the same result.

On my PC everything is working great:
enter image description here

But on my VPS it's not working at all:
enter image description here

And I've tried to remove the docker container and then call the localhost again and I get a connection refused, which means that there is nothing running on it.
enter image description here

I've tried a lot of thing like uninstall Docker and install it again, forcing the IP to 0.0.0.0 or 127.0.0.1 etc

Edit: Here is my /etc/hosts file
enter image description here

Edit:

If I run the command with --network="host" it does work on port 80 Also all of my container can't ping any IP on the internet and I tried this https://stackoverflow.com/a/45644890/8995817 but it didn't worked The only way to fix the internet connection is also to add the host network to the container but this isn't like it suppose to work.

Final edit: I've changing the hosting provider from IONOS to OVH and it now works. I think this was a firewall issue like this one: https://serverfault.com/questions/705192/iptables-rule-set-so-that-a-docker-container-can-access-a-service-on-a-host-ip But I could resolve it on IONOS

  • `sudo netstat -tunlp` and see if there is something running on port `80`. Also try `docker ps` to ensure the container `8a32d2` is actually running. – tftd Jun 25 '23 at 17:15
  • Yes there is the program 17917/docker-proxy running on the port 80 and when the docker doesn't run there is nothing for port 80, and docker ps is showing the container up and running – remi leclercq Jun 26 '23 at 07:38
  • Do a `cat /etc/hosts` and post it. Also, do you have IPv6 enabled? – tftd Jun 26 '23 at 07:50
  • I've updated my post and IPv6 is enabled – remi leclercq Jun 26 '23 at 15:04
  • Try disabling IPv6, rebooting and trying starting the container again. Sometimes IPv6 causes problems. https://askubuntu.com/a/957361/68413 – tftd Jun 26 '23 at 16:00
  • I tried but same result, I've edited my first post with new information. – remi leclercq Jun 26 '23 at 21:58
  • In that case, maybe you have a firewall problem. `iptables -nvL` would give you more information. :) – tftd Jun 27 '23 at 16:21
  • 1
    Thanks a lot for helping me, like you said I think this was a firewall issue, I've changed the hosting provider and it now works. See my last `edit` – remi leclercq Jun 28 '23 at 11:10
  • You're welcome. Happy dockerizing apps! :D – tftd Jun 28 '23 at 12:47

2 Answers2

0

Most likely you have the same port, try changing to -p 8080:80

  • Same issue nothing happens what ever the port I'm using – remi leclercq Jun 25 '23 at 19:22
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 27 '23 at 22:40
0

Probably you could try removing the -d flag and up the docker using the mentioned command. And can simply go through the error logs :) [error messages are damn cool to have, than having a unusually tidy output]

  • There are no errors in the docker logs for this container and nothing logs when I try to call the localhost on port 80. I think there is something to dig here it's like the container is up and running but it is not triggered – remi leclercq Jun 26 '23 at 07:40