【问题标题】:docker daemon is not startabledocker daemon 无法启动
【发布时间】:2020-10-23 13:00:28
【问题描述】:

简介

今天我不得不从我自己的虚拟服务器转移到我们公司的 linux 服务器,其中安装了 docker 版本 18.09.2 build 6247962。为我提供错误消息的服务器是 ubuntu 18.04 lts 服务器,我的内核:4.4.0-042stab141.3

很遗憾,我无法与老管理员交谈,因为他两年前离开了公司

我做了什么:

我的网络爬虫需要 docker。我不确定,如果我已经得到了正确的图像,所以尝试了:

sudo docker pull scrapinghub/splash

执行此命令后出现以下错误:

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

我也尝试了chmod 666 /usr/run/docker.sock,因为这是我在 stackoverflow 上读到的“解决方案”。

当我执行 service docker status 我得到:

docker.service - Docker Application Container Engine 
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Fri 2020-10-23 11:46:30 CEST;   43min ago
Docs: https://docs.docker.com
Process: 7881 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 7881 (code=exited, status=1/FAILURE)

另外,如果我执行docker ps,查看我的容器,我会得到:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/json: dial unix /var/run/docker.sock: connect: permission denied

当以 root 身份执行时,我再次获得:

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

我知道有几个关于该错误的主题,但没有一个对我有帮助,所以我现在正在尝试使用我自己的错误消息。

编辑

systemctl 状态泊坞窗:

* docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Fri 2020-10-23 14:44:43 CEST; 21min ago
     Docs: https://docs.docker.com
  Process: 12126 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 12126 (code=exited, status=1/FAILURE)

dockerd

INFO[2020-10-23T15:16:41.905718923+02:00] libcontainerd: started new docker-containerd process  pid=13326
INFO[2020-10-23T15:16:41.905847880+02:00] parsed scheme: "unix"                         module=grpc
INFO[2020-10-23T15:16:41.905859360+02:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-10-23T15:16:41.905903222+02:00] ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]  module=grpc
INFO[2020-10-23T15:16:41.905918045+02:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-10-23T15:16:41.905969169+02:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420601340, CONNECTING  module=grpc
INFO[2020-10-23T15:16:41.935402002+02:00] starting containerd                           revision=9754871865f7fe2f4e74d43e2fc7ccd237edcbce version=docker-18.09.2
INFO[2020-10-23T15:16:41.935710291+02:00] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[2020-10-23T15:16:41.935737945+02:00] loading plugin "io.containerd.snapshotter.v1.btrfs"...  type=io.containerd.snapshotter.v1
WARN[2020-10-23T15:16:41.936336356+02:00] failed to load plugin io.containerd.snapshotter.v1.btrfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
INFO[2020-10-23T15:16:41.936354852+02:00] loading plugin "io.containerd.snapshotter.v1.aufs"...  type=io.containerd.snapshotter.v1
WARN[2020-10-23T15:16:41.937768910+02:00] failed to load plugin io.containerd.snapshotter.v1.aufs  error="modprobe aufs failed: "modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.4.0-042stab141.3/modules.builtin.bin'\nmodprobe: FATAL: Module aufs not found in directory /lib/modules/4.4.0-042stab141.3\n": exit status 1"
INFO[2020-10-23T15:16:41.937790278+02:00] loading plugin "io.containerd.snapshotter.v1.native"...  type=io.containerd.snapshotter.v1
INFO[2020-10-23T15:16:41.937817682+02:00] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  type=io.containerd.snapshotter.v1
INFO[2020-10-23T15:16:41.937893773+02:00] loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
WARN[2020-10-23T15:16:41.938518477+02:00] failed to load plugin io.containerd.snapshotter.v1.zfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter"
INFO[2020-10-23T15:16:41.938534393+02:00] loading plugin "io.containerd.metadata.v1.bolt"...  type=io.containerd.metadata.v1
WARN[2020-10-23T15:16:41.938549461+02:00] could not use snapshotter zfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter"
WARN[2020-10-23T15:16:41.938557138+02:00] could not use snapshotter btrfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
WARN[2020-10-23T15:16:41.938565014+02:00] could not use snapshotter aufs in metadata plugin  error="modprobe aufs failed: "modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.4.0-042stab141.3/modules.builtin.bin'\nmodprobe: FATAL: Module aufs not found in directory /lib/modules/4.4.0-042stab141.3\n": exit status 1"
INFO[2020-10-23T15:16:41.938661276+02:00] loading plugin "io.containerd.differ.v1.walking"...  type=io.containerd.differ.v1
INFO[2020-10-23T15:16:41.938679507+02:00] loading plugin "io.containerd.gc.v1.scheduler"...  type=io.containerd.gc.v1
INFO[2020-10-23T15:16:41.938717611+02:00] loading plugin "io.containerd.service.v1.containers-service"...  type=io.containerd.service.v1
INFO[2020-10-23T15:16:41.938730440+02:00] loading plugin "io.containerd.service.v1.content-service"...  type=io.containerd.service.v1
INFO[2020-10-23T15:16:41.938744454+02:00] loading plugin "io.containerd.service.v1.diff-service"...  type=io.containerd.service.v1
INFO[2020-10-23T15:16:41.938761110+02:00] loading plugin "io.containerd.service.v1.images-service"...  type=io.containerd.service.v1
INFO[2020-10-23T15:16:41.938772688+02:00] loading plugin "io.containerd.service.v1.leases-service"...  type=io.containerd.service.v1
INFO[2020-10-23T15:16:41.938784541+02:00] loading plugin "io.containerd.service.v1.namespaces-service"...  type=io.containerd.service.v1
INFO[2020-10-23T15:16:41.938796278+02:00] loading plugin "io.containerd.service.v1.snapshots-service"...  type=io.containerd.service.v1
INFO[2020-10-23T15:16:41.938807356+02:00] loading plugin "io.containerd.runtime.v1.linux"...  type=io.containerd.runtime.v1
INFO[2020-10-23T15:16:41.938875766+02:00] loading plugin "io.containerd.runtime.v2.task"...  type=io.containerd.runtime.v2
INFO[2020-10-23T15:16:41.938921789+02:00] loading plugin "io.containerd.monitor.v1.cgroups"...  type=io.containerd.monitor.v1
INFO[2020-10-23T15:16:41.939301371+02:00] loading plugin "io.containerd.service.v1.tasks-service"...  type=io.containerd.service.v1
INFO[2020-10-23T15:16:41.939328814+02:00] loading plugin "io.containerd.internal.v1.restart"...  type=io.containerd.internal.v1
INFO[2020-10-23T15:16:41.939371309+02:00] loading plugin "io.containerd.grpc.v1.containers"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939383717+02:00] loading plugin "io.containerd.grpc.v1.content"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939395037+02:00] loading plugin "io.containerd.grpc.v1.diff"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939405310+02:00] loading plugin "io.containerd.grpc.v1.events"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939439881+02:00] loading plugin "io.containerd.grpc.v1.healthcheck"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939451270+02:00] loading plugin "io.containerd.grpc.v1.images"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939461540+02:00] loading plugin "io.containerd.grpc.v1.leases"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939477843+02:00] loading plugin "io.containerd.grpc.v1.namespaces"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939488529+02:00] loading plugin "io.containerd.internal.v1.opt"...  type=io.containerd.internal.v1
INFO[2020-10-23T15:16:41.939543415+02:00] loading plugin "io.containerd.grpc.v1.snapshots"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939558389+02:00] loading plugin "io.containerd.grpc.v1.tasks"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939568889+02:00] loading plugin "io.containerd.grpc.v1.version"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939579026+02:00] loading plugin "io.containerd.grpc.v1.introspection"...  type=io.containerd.grpc.v1
INFO[2020-10-23T15:16:41.939748944+02:00] serving...                                    address="/var/run/docker/containerd/docker-containerd-debug.sock"
INFO[2020-10-23T15:16:41.939799183+02:00] serving...                                    address="/var/run/docker/containerd/docker-containerd.sock"
INFO[2020-10-23T15:16:41.939810589+02:00] containerd successfully booted in 0.005619s
INFO[2020-10-23T15:16:41.946915966+02:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420601340, READY  module=grpc
INFO[2020-10-23T15:16:41.950501665+02:00] parsed scheme: "unix"                         module=grpc
INFO[2020-10-23T15:16:41.950522807+02:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-10-23T15:16:41.950564242+02:00] parsed scheme: "unix"                         module=grpc
INFO[2020-10-23T15:16:41.950575481+02:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-10-23T15:16:41.950676109+02:00] ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]  module=grpc
INFO[2020-10-23T15:16:41.950697518+02:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-10-23T15:16:41.950746317+02:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420601570, CONNECTING  module=grpc
INFO[2020-10-23T15:16:41.950889604+02:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420601570, READY  module=grpc
INFO[2020-10-23T15:16:41.950962148+02:00] ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]  module=grpc
INFO[2020-10-23T15:16:41.950978801+02:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-10-23T15:16:41.951015340+02:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420601810, CONNECTING  module=grpc
INFO[2020-10-23T15:16:41.951146523+02:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420601810, READY  module=grpc
ERRO[2020-10-23T15:16:41.952596133+02:00] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.  storage-driver=overlay2
ERRO[2020-10-23T15:16:41.953602275+02:00] AUFS was not found in /proc/filesystems       storage-driver=aufs
ERRO[2020-10-23T15:16:41.954528718+02:00] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.  storage-driver=overlay
INFO[2020-10-23T15:16:41.956786508+02:00] Graph migration to content-addressability took 0.00 seconds
WARN[2020-10-23T15:16:41.958146162+02:00] Your kernel does not support oom control
WARN[2020-10-23T15:16:41.958167327+02:00] Your kernel does not support memory swappiness
WARN[2020-10-23T15:16:41.958182470+02:00] Your kernel does not support kernel memory limit
WARN[2020-10-23T15:16:41.958198841+02:00] Unable to find cpu cgroup in mounts
WARN[2020-10-23T15:16:41.958238330+02:00] Unable to find cpuset cgroup in mounts
WARN[2020-10-23T15:16:41.958309720+02:00] mountpoint for pids not found
INFO[2020-10-23T15:16:41.963433348+02:00] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=plugins.moby
INFO[2020-10-23T15:16:41.963543844+02:00] stopping healthcheck following graceful shutdown  module=libcontainerd
INFO[2020-10-23T15:16:41.967297616+02:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420601810, TRANSIENT_FAILURE  module=grpc
INFO[2020-10-23T15:16:41.967319558+02:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420601810, CONNECTING  module=grpc
Error starting daemon: Devices cgroup isn't mounted
-- Logs begin at Fri 2020-10-23 11:03:38 CEST. --
Oct 23 14:44:39 dockerd[12126]: time="2020-10-23T14:44:39.944764478+02:00" level=warning msg="Your kernel does not support memory swappiness"
Oct 23 14:44:39 dockerd[12126]: time="2020-10-23T14:44:39.944777538+02:00" level=warning msg="Your kernel does not support kernel memory limit"
Oct 23 14:44:39 dockerd[12126]: time="2020-10-23T14:44:39.944793390+02:00" level=warning msg="Unable to find cpu cgroup in mounts"
Oct 23 14:44:39 dockerd[12126]: time="2020-10-23T14:44:39.944824929+02:00" level=warning msg="Unable to find cpuset cgroup in mounts"
Oct 23 14:44:39  dockerd[12126]: time="2020-10-23T14:44:39.944869519+02:00" level=warning msg="mountpoint for pids not found"
Oct 23 14:44:39 dockerd[12126]: time="2020-10-23T14:44:39.947106531+02:00" level=info msg="stopping event stream following graceful shutdown" error="context canceled" module=libcontainerd namespace=plugins.moby
Oct 23 14:44:39 dockerd[12126]: time="2020-10-23T14:44:39.947131964+02:00" level=info msg="stopping healthcheck following graceful shutdown" module=libcontainerd
Oct 23 14:44:39 dockerd[12126]: time="2020-10-23T14:44:39.951205781+02:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc42401c7d0, TRANSIENT_FAILURE" module=grpc
Oct 23 14:44:39 dockerd[12126]: time="2020-10-23T14:44:39.951239041+02:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc42401c7d0, CONNECTING" module=grpc
Oct 23 14:44:40 dockerd[12126]: Error starting daemon: Devices cgroup isn't mounted

另外,如果我尝试使用 docker info,我会收到以下错误:

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

【问题讨论】:

  • journalctl -xesystemctl status docker 说什么?几天前我遇到了一个问题,是由默认的iptables 更改为iptables-ntf 引起的。
  • 解决方案是顺便说一句,update-alternatives --set iptables /usr/sbin/iptables-legacy
  • 我添加了 systemctl status docker 的输出
  • 运行您的解决方案时,我得到:update-alternatives: error: no alternatives for iptables
  • Devices cgroup isn't mounted - 你在运行什么 linux?什么分布?您正在使用什么服务和初始化管理器(systemd/upstart/rc-something)?您能否发布mountfindmnt 的输出?

标签: linux docker


【解决方案1】:

由于我没有从提供的链接中的聊天中得到答复https://chat.stackoverflow.com/rooms/223520/discussion-between-y-y-and-moritz-sauter

因此,我下面的回答有一些假设。

您似乎一直在使用 AUFS 作为“虚拟服务器”中的 docker 存储驱动程序,这可以从 docker info 或通常在此路径 /etc/docker/ 中找到的 daemon.json 文件中确认。

鉴于上述情况属实,当您迁移到具有相当新的 Ubuntu 和内核的新“公司 Linux 服务器”时,很有可能默认未启用 AUFS 驱动程序,您可以通过@987654328 进行验证@。

我的自省来自你的 docker 日志,它有一个警告

WARN[2020-10-23T15:16:41.937768910+02:00] failed to load plugin io.containerd.snapshotter.v1.aufs error="modprobe aufs failed: "modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.4.0-042stab141.3/modules.builtin.bin'\nmodprobe: FATAL: Module aufs not found in directory /lib/modules/4.4.0-042stab141.3\n": exit status 1"

现在如果以上都是真的怎么解决? 您可能不得不从 AUFS 转移到 overlay2 check 这个答案。除非您有严格的理由坚持使用 AUFS,否则您将不得不切换到不同的内核,answer 可能会有所帮助

注意:如果您使用一些非标准内核或较旧的内核,请自行承担风险,因为可能存在一些您可能需要修补的漏洞

【讨论】:

  • 我读到支持大约 3.10+ 的内核,我的是 4.40.62 或类似的东西,所以我认为它不应该依赖它。我和我的老板谈过,我们决定把所有东西都转移到我的服务器上,所以我认为我的问题现在已经解决了。幸运的是我的头痛,对我的经历不利
【解决方案2】:

根据所有 docker 命令输出,看起来 docker-daemon 已关闭。

您可以尝试使用以下命令之一启动 docker-daemon。

$ sudo systemctl start docker

$ sudo service docker start

启动后,您的命令将开始工作。

如果失败,您可以重置限制并重新启动。

sudo systemctl reset-failed docker.service

【讨论】:

  • @Ikamal,感谢您的回答,但这是我尝试的第一件事。 Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
  • 您可以尝试重置失败并重试吗?
  • 原谅?失败是什么意思?
  • 请试试这个sudo systemctl reset-failed docker.service,然后尝试从sudo systemctl start docker开始
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-14
  • 2016-12-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多