run docker-daemon with --iptables false

+4 votes

I want to set up a static firewall and network configuration, so that I can run docker-daemon with --iptables=false (i.e. not having Docker modifying the firewall), in a way that containers should not exposed to the external world, but it's still possible to have containers connected to services when using docker-compose

Mar 27, 2018 in DevOps & Agile by Atul
• 10,240 points

edited Oct 12, 2018 by Kalgi 10,094 views

2 answers to this question.

+2 votes
Best answer
The docker network model uses iptables to set up internet connectivity for your containers. Only set iptables=false if you explicitly do not want your containers that are using bridge or overlay network drivers to have any network connectivity at all.

When you start the daemon with iptables=true, it will set up the required rules in your firewall. When docker shuts down, I don't believe it tears those rules down, so they stick around. This is why you get internet connectivity after starting docker back up with iptables=false. If you want to preserve those rules on the next docker startup after a reboot, the best way is to keep iptables=true.
answered Aug 2, 2018 by Kalgi
• 52,350 points

selected Oct 12, 2018 by Omkar
+1 vote

I agree with @Kalgi, iptables=false is necessary to setup the firewall but also make sure docker shouldn't overrides the firewall configuration.

answered Oct 12, 2018 by Hannah
• 18,540 points

Related Questions In DevOps & Agile

+1 vote
2 answers

How do I run Apache server from Docker without mapping to a location?

If you're seeing a 500 error, that's ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by lina
• 8,220 points
2,165 views
+1 vote
1 answer

Isolate PHP applications with Docker

That is the idea: you can make ...READ MORE

answered Jul 12, 2018 in DevOps & Agile by Kalgi
• 2,680 points
719 views
0 votes
2 answers

How does Docker for Windows run Linux containers?

One of the most important enhancements is ...READ MORE

answered Aug 29, 2020 in DevOps & Agile by Pistle
• 1,000 points
1,073 views
0 votes
1 answer

How to a run deployed app in Docker for Windows?

To deploy an ASP.NET web application to ...READ MORE

answered Aug 30, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
1,186 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,100 points
2,687 views
+14 votes
5 answers

How do I run a cron job inside a docker container

If you can SSH into your server ...READ MORE

answered Jul 27, 2018 in DevOps & Agile by Kalgi
• 52,350 points
16,489 views
+5 votes
3 answers

Error while trying to install postgis extension with greenplum

Try re downloading the package and installing ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,208 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP