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.
More on Networking, DNS and firewalls
`curl http://10.0.1.20:8080` returns `curl: (7) Failed to connect to 10.0.1.20 port 8080: Connection refused`.BeginnerThe same request instead hangs and ends with `curl: (28) Failed to connect to 10.0.1.20 port 8080 after 130000 ms: Connection timed out`. How is this different from "refused"?Beginner`ping google.com` fails with `ping: google.com: Temporary failure in name resolution`, but `ping 8.8.8.8` works.Beginner`dig api.internal` works, but the application and `curl` fail with `Could not resolve host: api.internal`.Intermediate`/etc/resolv.conf` changes you made disappear after a reboot or a few minutes.BeginnerDNS lookups take exactly 5 seconds before succeeding.Intermediate