centos7安装docker报错iptables v1.4.21: Couldn‘t load target `DOCKER-ISOLATION‘

最近在学习docker过程中,第一步docker启动,就遇到了问题,按照官网步骤安装完成后,进行启动,报错:iptables v1.4.21: Couldn’t load target `DOCKER-ISOLATION’,具体如下:

 2022-07-01 06:18:25 ERROR: INVALID_TYPE: structure size mismatch 16 != 13
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -C FORWARD -j DOCKER-ISOLATION' failed: iptables v1.4.21: Couldn't load target `DOCKER-ISOLATION':No such file or directory
                                     
                                     Try `iptables -h' or 'iptables --help' for more information.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -D OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -D OUTPUT -m addrtype --dst-type LOCAL -j DOCKER' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -D PREROUTING' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -D OUTPUT' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -F DOCKER-ISOLATION' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -X DOCKER-ISOLATION' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -n -L DOCKER' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -n -L DOCKER' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -n -L DOCKER-ISOLATION-STAGE-1' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -n -L DOCKER-ISOLATION-STAGE-2' failed: iptables: No chain/target/match by that name.
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -C DOCKER-ISOLATION-STAGE-1 -j RETURN' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t filter -C DOCKER-ISOLATION-STAGE-2 -j RETURN' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -C DOCKER -i docker0 -j RETURN' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -D FORWARD -i docker0 -o docker0 -j DROP' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: INVALID_ZONE: docker
Jul 01 06:18:25 root dockerd[3099]: time="2022-07-01T06:18:25.949084585-04:00" level=warning msg="could not create bridge network for id c16a1afb8269e0c2975e1fa4f83afa877f5a6892b583196c54dc6b4936644d42 bridge name docker0 while booting up from persi
Jul 01 06:18:25 root dockerd[3099]: time="2022-07-01T06:18:25.964995921-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
Jul 01 06:18:25 root firewalld[917]: 2022-07-01 06:18:25 ERROR: COMMAND_FAILED: '/sbin/iptables -w2 -D FORWARD -i docker0 -o docker0 -j DROP' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jul 01 06:18:26 root firewalld[917]: 2022-07-01 06:18:26 ERROR: INVALID_ZONE: docker
Jul 01 06:18:26 root dockerd[3099]: time="2022-07-01T06:18:26.028214802-04:00" level=info msg="stopping event stream following graceful shutdown" error="" module=libcontainerd namespace=moby
Jul 01 06:18:26 root dockerd[3099]: failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to program NAT chain: INVALID_ZONE: docker
Jul 01 06:18:26 root systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jul 01 06:18:26 root systemd[1]: Failed to start Docker Application Container Engine.

刚开始,将防火墙进行关闭,确实能够启动

systemctl stop firewalld

但是总觉得,问题不在这里,经过查找发现,在centos7中,使用firewall代替了iptables,解决本次问题,还是将firewall关掉,启用iptables

# 关闭防火墙
systemctl stop firewalld
 
# 取消开机启动
systemctl disable firewalld

#安装iptables
yum install iptables-services -y

# 重启防火墙使配置生效
systemctl restart iptables
 
# 设置防火墙开机启动
systemctl enable iptables

问题解决!记录一下,以便于日后学习

你可能感兴趣的:(日常杂项,docker)