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:
But on my VPS it's not working at all:
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.
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
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