Docker ignores UFW (Open port nightmare)

You think blocking a port in UFW keeps your server safe. It doesn't. Docker bypasses UFW and injects its own iptables rules, leaving your container ports wide open. Then you wonder how your database got leaked.

Why?

Docker doesn't care about UFW. It routes traffic directly via iptables.

The Fix:

Stop Docker from touching iptables.

  1. Open: nano /etc/docker/daemon.json

  2. Paste this:

JSON
 
{
  "iptables": false
}
  1. Restart service: systemctl restart docker

That's it. UFW is back in control. Note: You'll have to manually configure NAT/routing for containers now. (Megabre servers come with this patched out of the box).

🤔

Was this answer helpful?

Görüşünüz bizim için değerli!