docker 启动时报错如下

1
2
3
root@DESKTOP-3TQ8K9B:~# systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.

可以通过如下命令查看docker的启动日志

1
root@DESKTOP-3TQ8K9B:~# sudo dockerd --debug

报错信息汇总如下

错误1

报错信息如下:

1
2
3
4
5
root@DESKTOP-3TQ8K9B:~# sudo dockerd --debug
INFO[2022-08-05T23:05:51.543106408+08:00] Starting up
......
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))

可执行如下命令解决:

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