docker出现“Failing to start dockerd: failed to create NAT chain 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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值