首页 > 其他分享 >docker出现“Failing to start dockerd: failed to create NAT chain DOCKER”错误

docker出现“Failing to start dockerd: failed to create NAT chain DOCKER”错误

时间:2023-03-01 19:00:09浏览次数:48  
标签:iptables chain start create failed docker DOCKER

使用Windows的WSL 2里面的Ubuntu安装docker之后,启动docker服务一直失败,提示Docker is not running。使用dockerd命令会出现如下错误:

INFO[2023-03-01T18:22:07.565628800+08:00] [core] [Channel #7 SubChannel #8] Subchannel Connectivity change to IDLE  module=grpc
INFO[2023-03-01T18:22:07.565895700+08:00] [core] [Channel #7] Channel Connectivity change to IDLE  module=grpc
failed to start daemon: Error initializing network controller: error obtaining controller instance: unable to add return rule in DOCKER-ISOLATION-STAGE-1 chain:  (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables):  RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1
 (exit status 4))

解决办法:

docker安装程序使用iptables进行nat转换。不幸的是Debian使用nftables。您可以将条目转换为nftables,或者只是设置Debian以使用遗留的iptables。

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

#启动命令
sudo service docker start

参考链接:

https://forums.docker.com/t/failing-to-start-dockerd-failed-to-create-nat-chain-docker/78269

https://stackoverflow.com/questions/57351688/unable-to-start-docker-in-wsl2-using-new-windows-terminal

https://stackoverflow.com/questions/48008675/run-docker-on-ubuntu-on-windows-subsystem-for-linux/64261697#64261697

标签:iptables,chain,start,create,failed,docker,DOCKER
From: https://www.cnblogs.com/zuiyixin/p/17169350.html

相关文章