Docker: How to re-create dockers additional iptables rules?

后端 未结 3 1041
心在旅途
心在旅途 2020-12-24 05:57

When the docker-demon starts it adds a couple of rules to iptables. When all rules are deleted via iptables -F i have to stop and restart the docker demon to r

3条回答
  •  轮回少年
    2020-12-24 06:08

    If you're running Ubuntu on the host, you can use the iptables-save utility to save the iptables rules to a file after you start the docker daemon. Then, once you flush the old rules, you can simply restore the original docker rules using iptables-restore & the saved rules file.

    If you don't want to restore all the old iptables rules, you can alter the saved rules file to keep only the ones you need.

    If you're running another operating system, you might find a similar alternative.

提交回复
热议问题