【问题解决记录】树莓派4b安装docker启动失败Failed to start Docker Application Container Engine.报错解决方法

安装docker教程地址

$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun

通过以上安装脚本进行安装,结果启动的时候报下面错误:

wi@raspberrypi:~ $ sudo systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-03-29 15:29:14 BST; 11s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Process: 8874 ExecStart=/usr/bin/dockerd (code=exited, status=1/FAILURE)
Main PID: 8874 (code=exited, status=1/FAILURE)
CPU: 427ms

Mar 29 15:29:14 raspberrypi systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Mar 29 15:29:14 raspberrypi systemd[1]: Stopped Docker Application Container Engine.
Mar 29 15:29:14 raspberrypi systemd[1]: docker.service: Start request repeated too quickly.
Mar 29 15:29:14 raspberrypi systemd[1]: docker.service: Failed with result ‘exit-code’.
Mar 29 15:29:14 raspberrypi systemd[1]: Failed to start Docker Application Container Engine.

journalctl-xe

DEBU[2023-03-29T15:35:09.941495135+01:00] Cleaning up old mountid : done.
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables/1.8.7 Failed to initialize nft: Protocol not supported
(exit status 1)
看到这里日志写iptables问题,应该就是iptalbes问题。

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf

引用:https://blog.csdn.net/qq_37196265/article/details/124650639

如果还是没有解决,可以看看github上面的解决方案

issues/1105

你可能感兴趣的:(docker,运维,容器)