现象
安装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