I have a webservice running inside a docker instance which was run using the following command:
sudo docker run -d -p 4040:4040 ....
My UFW rules look like this:
~ sudo ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
4040 DENY Anywhere
22 ALLOW Anywhere (v6)
4040 DENY Anywhere (v6)
When I access the box directly via its IP, I can access port 4040. Why is the ufw rule not blocking it?
Note: As part of the docker installation, I changed
DEFAULT_FORWARD_POLICY="DROP" to DEFAULT_FORWARD_POLICY="ACCEPT"
in /etc/default/ufw as per dockers instructions here (http://docs.docker.io/en/latest/installation/ubuntulinux/#docker-and-ufw)