在raspbianstretch上安装docker时出错

在raspbianstretch上安装docker时出错

我正在尝试在 rpi4 上安装 docker,但运行时出现此错误

sudo apt-get install docker-ce docker-ce-cli containerd.io -y

我有

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2021-02-15 19:44:36 GMT; 14ms ago
     Docs: https://docs.docker.com
  Process: 9174 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 9174 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce:armhf (--configure):
 installed docker-ce:armhf package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of docker-ce-rootless-extras:armhf:
 docker-ce-rootless-extras:armhf depends on docker-ce; however:
  Package docker-ce:armhf is not configured yet.

dpkg: error processing package docker-ce-rootless-extras:armhf (--configure):
 dependency problems - leaving unconfigured
Processing triggers for systemd (241-7~deb10u6) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...
Errors were encountered while processing:
 docker-ce:armhf
 docker-ce-rootless-extras:armhf
E: Sub-process /usr/bin/dpkg returned an error code (1)

我的journalctl日志

$ journalctl -fu docker
-- Logs begin at Thu 2019-02-14 10:11:58 GMT. --
Feb 15 19:44:43 raspberrypi4 dockerd[9311]: failed to start daemon: error initializing graphdriver: driver not supported
Feb 15 19:44:43 raspberrypi4 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Feb 15 19:44:43 raspberrypi4 systemd[1]: docker.service: Failed with result 'exit-code'.
Feb 15 19:44:43 raspberrypi4 systemd[1]: Failed to start Docker Application Container Engine.
Feb 15 19:44:45 raspberrypi4 systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.
Feb 15 19:44:45 raspberrypi4 systemd[1]: docker.service: Scheduled restart job, restart counter is at 4.
Feb 15 19:44:45 raspberrypi4 systemd[1]: Stopped Docker Application Container Engine.
Feb 15 19:44:45 raspberrypi4 systemd[1]: docker.service: Start request repeated too quickly.
Feb 15 19:44:45 raspberrypi4 systemd[1]: docker.service: Failed with result 'exit-code'.
Feb 15 19:44:45 raspberrypi4 systemd[1]: Failed to start Docker Application Container Engine.

怎么了 ?

答案1

我在安装内核头文件后遇到了同样的问题。如果您也这样做了,请记住重新启动 RasPi,然后检查服务状态

sudo systemctl status docker.service

我也更喜欢在 中指定主机/etc/docker/daemon.json,请参阅这里更多细节。

所以我必须删除单元配置-H中的选项systemd/lib/systemd/system/docker.service

不确定到底是怎么回事,但重启后一切都正常运行了。不确定这是永久修复,因为该文件可以由您的下一个apt upgradeapt install docker-ce.

相关内容