安装docker-ce后,docker报错:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.
docker.service: Main process exited, code=exited, status=1/FAILURE
原因:
新的ubuntu系统使用了iptables-nft,而WSL2不支持导致的。
解决办法:
update-alternatives --config iptables
There are 2 choices for the alternative iptables (providing /usr/sbin/iptables).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/sbin/iptables-nft 20 auto mode
1 /usr/sbin/iptables-legacy 10 manual mode
2 /usr/sbin/iptables-nft 20 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/sbin/iptables-legacy to provide /usr/sbin/iptables (iptables) in manual mode
选择 options 1。
docker -v
Docker version 23.0.0, build e92dd87
至此,问题解决。