来源:https://blog.csdn.net/weixin_42599091/article/details/130158157
doker 使用 iptables 进行网络转发,而 firewalld 防火墙也是基于 iptables 的,所以在启动 firewalld 后,需要重启一下 docker 服务 systemctl restart docker
或者使 docker 绕过防火墙
##修改docker配置
vim /etc/docker/daemon.json
# 添加规则
{
...
"experimental" : true,
"iptables": false
}
# 重启 docker
systemctl daemon-reload
systemctl restart docker
# 启动容器
docker run -d -p 80:80 nginx
# 查看iptables规则 发现 docker 没有添加规则
iptables --list