Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

The --iptables option only applies to the Docker daemon; it's not a per-container option. The corollary is that this isn't something you could ever set from your docker-compose.yaml file.

You would need to modify the options passed to the Docker daemon; on Red Hat systems and derivatives this means you would modify /etc/sysconfig/docker and updte the OPTIONS= line (and restart Docker). There will be a similar process for other distributions.

On Ubuntu/Debian systems, you edit /etc/default/docker so that docker_opts is uncommented and contains the iptables addition: docker_opts="--dns 8.8.8.8 --dns 8.8.4.4 --iptables=false" ( source ) Dolan Antenucci Apr 8, 2017 at 3:58 It's also worth noting (and probably worth adding a note in your answer) that by enabling this setting after previously running docker w/ some network configuration will cause the related iptables rules to remain enabled -- at least in my experience. So if someone is trying to use this --iptables=false setting so that they can manually control their own firewall (e.g., UFW), then they should clear the iptable rules appropriately after enabling this docker setting (and restarting docker/server). Dolan Antenucci Apr 8, 2017 at 4:05

Could check out saltstack if you're looking for this level of automation. They have a dockerng state which allows you to specify options.

https://docs.saltstack.com/en/latest/ref/states/all/salt.states.dockerng.html

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .