【无标题】

现象
安装Docker官方给出的文档进行安装,都没有什么问题:

直到我执行sudo systemctl start docker时,

报错:
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

接着执行dockerd

最后一句话
failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to program NAT chain: INVALID_ZONE: docker
是比较明显的错误信息

问题
这是由于firewalld与docker冲突的问题,从本质上来说,应该是firewalld与iptables的冲突,

解决方案
方法一:
关闭firewalld这个方法是有效的:

```
systemctl stop firewalld
systemctl disable firewalld
```

方法二(更新):
在Centos上安装Docker对linux版本有要求,最新的Docker不支持老版本的CentOS。
我的大概是7.4x,升级后可以启动!

sudo yum -y update
1
方法三:

方法来源:Stackoverflow
https://stackoverflow.com/questions/65213831/failed-to-start-daemon-error-initializing-network-controller-error-creating-de

$ firewall-cmd --get-active-zones
FedoraWorkstation
  interfaces: ens4u1u2 wlp59s0
docker
  interfaces: br-48d7d996793a
libvirt
  interfaces: virbr0
trusted
  interfaces: docker0


the interface docker0 seems to be in the trusted zone. But there’s another zone called docker.

So I decided to give it a shot and add it to the docker zone instead.

$ sudo firewall-cmd --permanent --zone=docker --change-interface=docker0
$ sudo firewall-cmd --reload
1
2
Looks like this afterwards:

$ firewall-cmd --get-active-zones
FedoraWorkstation
  interfaces: ens4u1u2 wlp59s0
docker
  interfaces: br-48d7d996793a docker0
libvirt
  interfaces: virbr0

7
Seems to work.
Maybe someone can shed more light on this.
Edit: added firewall-cmd --reload as pointed out in the comments
————————————————
版权声明:本文为CSDN博主「Honyelchak」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_38072683/article/details/112854073

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值