Interview Prep/Linux/Networking, DNS and firewalls

Docker containers lose network access after you restart firewalld or flush iptables.

AdvancedTroubleshootingNetworking, DNS and firewalls
Answer

Likely causes → Docker inserts its own NAT and FORWARD rules; flushing or reloading the firewall wipes them.

Diagnose →

sudo iptables -t nat -L DOCKER -n
sudo nft list ruleset | grep -i docker

Fix → sudo systemctl restart docker to recreate its rules. Put custom rules in the DOCKER-USER chain so Docker leaves them alone.

Prevent → Avoid iptables -F on container hosts; manage rules in DOCKER-USER.

All Linux questions Roadmap: Linux

More on Networking, DNS and firewalls