在docker运行时,有时可正常运行,若加上防火墙或docker内部端口不能访问时,添加以下代码可修复问题
1.找到 cd /etc/sysctl.d/
2.在99-sysctl.conf配置文件中添加
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
3.重新刷新系统配置
sysctl --system
4.重启docker 守护进程
systemctl daemon-reload
systemctl restart docker
即可修复iptables 异常异常问题
以下是快捷代码:
cat <<EOF > /etc/sysctl.d/*.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
systemctl daemon-reload
systemctl restart docker