Paul's Programming Notes     Archive     Feed     Github

Docker - ufw rules ignored

I recently learned that docker will ignore ufw (uncomplicated firewall) rules by default. This means that it will still expose ports that are blocked by ufw.

The fix involved adding this to /etc/docker/daemon.json:

{
    "iptables": false,
    "ip6tables": false
}

Then I restarted the docker daemon with sudo systemctl restart docker.

More details