'Docker container not accessible through server public IP (working only with UFW disabled)
I bought a VPS on Vultr (host system Ubuntu 22.04) with the example IP identified as 123.123.123 and tried to launch a new container with the following command:
docker run -d -p 8081:80 nginx:alpine
Knowing the public IP of my server, I should theoretically be able to access it through the following address in the browser http://123.123.123:8081. However, it isn't working at least publicly. Because if I decide to stop UFW in the host (using Ubuntu 22.04):
service ufw stop
Then I'm able to access it without any problem (or using cURL through SSH without disabling UFW):
But, after enabling the uncomplicated firewall with:
service ufw start
Then the host is unreachable:
These are the current rules of UFW:
I have as well a Portainer instance through docker as well (which works as well only when UFW is disabled):
I tried as well using Nginx Proxy Manager, but I'm unable to make it work with something so simple as this nginx basic container. Any help is appreciated and I'd be happy to provide more information if it's necessary.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|