How can I restart iptables in Ubuntu 20.04?

To manage my firewall I use ufw. But Docker modifies itpables rules directly. I'm trying to do some testing to see what the effect of setting "iptables": false in /etc/docker/daemon.json, but it seems that once Docker has been started the iptables rules get set and won't go away:

$ cat /etc/docker/daemon.json
{ "iptables": false
}
$ sudo systemctl stop containerd docker.service docker.socket
$ sudo iptables -L | grep -i docker
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
DOCKER all -- anywhere anywhere
Chain DOCKER (1 references)
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (1 references)
Chain DOCKER-USER (1 references)

I figured out pretty quickly that there's no systemd unit for iptables, so I tried restarting ufw several different ways, but I guess since Docker bypasses ufw it doesn't have any effect.

I'm guessing rebooting my computer would do the trick but that's what I'm trying to avoid since I would like to do some testing that involves enabling and disabling the Docker iptables integration several times and I don't want to reboot every time.

1 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like