【发布时间】: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 -xe或systemctl 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)?您能否发布mount或findmnt的输出?