Make Docker work with iptables

Docker containers are just like a computer, the networking between host and containers is affected by the firewall. My iptables has a default DROP all policy, but it will make the Containers cannot communicate with the host. Here is the fix you’ll need.

Add this to your iptables rules script just below the DROP rules.

“docker0” is the default interface name for the docker networking, if you didn’t change anything, this is it.

Example iptables file:

 

Share your thoughts