无法连接到 unix:///var/run/docker.sock 上的 Docker 守护程序。docker 守护程序是否正在运行?

无法连接到 unix:///var/run/docker.sock 上的 Docker 守护程序。docker 守护程序是否正在运行?

树莓派 4 8GB

Ubuntu 20.04.2 LTS


在此之前,我可以毫无问题地运行一堆 Docker 容器。然而,我的 Pi 突然停止工作(无法通过 SSH 进入,无法启动 Nextcloud 或 Jellyfin),所以我决定软关机。我的 Pi 外壳有一个功能,如果你按住电源按钮 3 秒钟,它就会软关机。

当我重新启动它时,我的容器都没有运行。我运行docker container ls看看是否是这种情况,然后我得到了:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

在网上搜索了一下,StackOverflow 上有人建议我这样做sudo systemctl start docker。试过了,但得到:

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.

因此我运行了它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 Sun 2021-04-04 12:50:28 EDT; 11s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
    Process: 5618 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=2)
   Main PID: 5618 (code=exited, status=2)

Apr 04 12:50:26 ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 04 12:50:26 ubuntu systemd[1]: Failed to start Docker Application Container Engine.
Apr 04 12:50:28 ubuntu systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Apr 04 12:50:28 ubuntu systemd[1]: Stopped Docker Application Container Engine.
Apr 04 12:50:28 ubuntu systemd[1]: docker.service: Start request repeated too quickly.
Apr 04 12:50:28 ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 04 12:50:28 ubuntu systemd[1]: Failed to start Docker Application Container Engine.

还跑了journalctl -xe并且得到了:

-- The job identifier is 2207 and the job result is done.
Apr 04 12:50:28 ubuntu systemd[1]: docker.socket: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit docker.socket has successfully entered the 'dead' state.
Apr 04 12:50:28 ubuntu systemd[1]: Closed Docker Socket for the API.
-- Subject: A stop job for unit docker.socket has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit docker.socket has finished.
--
-- The job identifier is 2290 and the job result is done.
Apr 04 12:50:28 ubuntu systemd[1]: Stopping Docker Socket for the API.
-- Subject: A stop job for unit docker.socket has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit docker.socket has begun execution.
--
-- The job identifier is 2290.
Apr 04 12:50:28 ubuntu systemd[1]: Starting Docker Socket for the API.
-- Subject: A start job for unit docker.socket has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit docker.socket has begun execution.
--
-- The job identifier is 2290.
Apr 04 12:50:28 ubuntu systemd[1]: Listening on Docker Socket for the API.
-- Subject: A start job for unit docker.socket has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit docker.socket has finished successfully.
--
-- The job identifier is 2290.
Apr 04 12:50:28 ubuntu systemd[1]: docker.service: Start request repeated too quickly.
Apr 04 12:50:28 ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit docker.service has entered the 'failed' state with result 'exit-code'.
Apr 04 12:50:28 ubuntu systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: A start job for unit docker.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit docker.service has finished with a failure.
--
-- The job identifier is 2207 and the job result is failed.
Apr 04 12:50:28 ubuntu systemd[1]: docker.socket: Failed with result 'service-start-limit-hit'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit docker.socket has entered the 'failed' state with result 'service-start-limit-hit'.

我得到的信息并没有帮助我缩小范围,所以我继续搜索,发现其他人告诉我这样做sudo dockerd。这产生了以下警告:

INFO[2021-04-04T12:56:17.445820368-04:00] Starting up
INFO[2021-04-04T12:56:17.447780951-04:00] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.           conf: /run/systemd/resolve/resolv.conf
INFO[2021-04-04T12:56:17.449789072-04:00] parsed scheme: "unix"                         module=grpc
INFO[2021-04-04T12:56:17.449890775-04:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2021-04-04T12:56:17.449956182-04:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containe           rd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2021-04-04T12:56:17.449991293-04:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2021-04-04T12:56:17.452504633-04:00] parsed scheme: "unix"                         module=grpc
INFO[2021-04-04T12:56:17.452582725-04:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2021-04-04T12:56:17.452640502-04:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containe           rd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2021-04-04T12:56:17.452674465-04:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2021-04-04T12:56:17.486909155-04:00] [graphdriver] using prior storage driver: overlay2
WARN[2021-04-04T12:56:17.571738900-04:00] Your kernel does not support cgroup memory limit
WARN[2021-04-04T12:56:17.571820474-04:00] Your kernel does not support cgroup rt period
WARN[2021-04-04T12:56:17.571848455-04:00] Your kernel does not support cgroup rt runtime
WARN[2021-04-04T12:56:17.571874085-04:00] Your kernel does not support cgroup blkio weight
WARN[2021-04-04T12:56:17.571899381-04:00] Your kernel does not support cgroup blkio weight_device
INFO[2021-04-04T12:56:17.572419193-04:00] Loading containers: start.

所以我认为问题一定与我的内核有关。软关机是否以某种方式干扰了内核?我该如何恢复问题,以便让 Docker 再次启动并运行?

相关内容