首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Ubuntu上安装/运行Docker时出现问题(dockerd错误)/守护程序正在运行?内核升级?

在Ubuntu上安装/运行Docker时出现问题(dockerd错误)/守护程序正在运行?内核升级?
EN

Stack Overflow用户
提问于 2020-02-22 11:22:32
回答 2查看 666关注 0票数 1

我使用的是Ubuntu 18.04 (运行的是模拟的Windows),完全是个新手。我按照以下步骤安装了Docker,但无法将其安装到run

代码语言:javascript
复制
  882  sudo apt update
  883  sudo apt install apt-transport-https ca-certificates curl software-properties-common
  884  curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  885  sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
  886  sudo apt update
  887  apt-cache policy docker-ce
  888  sudo apt install docker-ce
  889  sudo systemctl status docker
  890  sudo /etc/init.d/docker start

到目前一切尚好。现在,为了检查您是否可以从Docker Hub访问和下载图像,我运行:

代码语言:javascript
复制
sudo docker run hello-world

我得到了以下错误:

代码语言:javascript
复制
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

运行sudo dockerd返回:

代码语言:javascript
复制
INFO[2020-02-22T11:09:04.509355900+08:00] Starting up
INFO[2020-02-22T11:09:04.516510800+08:00] libcontainerd: started new containerd process  pid=3705
INFO[2020-02-22T11:09:04.516870500+08:00] parsed scheme: "unix"                         module=grpc
INFO[2020-02-22T11:09:04.517102600+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-02-22T11:09:04.517288800+08:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-02-22T11:09:04.517495400+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-02-22T11:09:04.547297900+08:00] starting containerd                           revision=b34a5c8af56e510852c35414db4c1f4fa6172339 version=1.2.10
INFO[2020-02-22T11:09:04.548738200+08:00] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[2020-02-22T11:09:04.548914900+08:00] loading plugin "io.containerd.snapshotter.v1.btrfs"...  type=io.containerd.snapshotter.v1
WARN[2020-02-22T11:09:04.549228300+08: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-02-22T11:09:04.549457200+08:00] loading plugin "io.containerd.snapshotter.v1.aufs"...  type=io.containerd.snapshotter.v1
WARN[2020-02-22T11:09:04.553575600+08:00] failed to load plugin io.containerd.snapshotter.v1.aufs  error="modprobe aufs failed: "modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-17763-Microsoft/modules.dep.bin'\nmodprobe: FATAL: Module aufs not found in directory /lib/modules/4.4.0-17763-Microsoft\n": exit status 1"
INFO[2020-02-22T11:09:04.553871800+08:00] loading plugin "io.containerd.snapshotter.v1.native"...  type=io.containerd.snapshotter.v1
INFO[2020-02-22T11:09:04.554049900+08:00] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  type=io.containerd.snapshotter.v1
INFO[2020-02-22T11:09:04.554470800+08:00] loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
INFO[2020-02-22T11:09:04.554711200+08:00] skip loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
INFO[2020-02-22T11:09:04.555303000+08:00] loading plugin "io.containerd.metadata.v1.bolt"...  type=io.containerd.metadata.v1
WARN[2020-02-22T11:09:04.556436000+08: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-02-22T11:09:04.578612300+08:00] could not use snapshotter aufs in metadata plugin  error="modprobe aufs failed: "modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-17763-Microsoft/modules.dep.bin'\nmodprobe: FATAL: Module aufs not found in directory /lib/modules/4.4.0-17763-Microsoft\n": exit status 1"
WARN[2020-02-22T11:09:04.585873300+08: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: skip plugin"
INFO[2020-02-22T11:09:04.597785400+08:00] loading plugin "io.containerd.differ.v1.walking"...  type=io.containerd.differ.v1
INFO[2020-02-22T11:09:04.605886800+08:00] loading plugin "io.containerd.gc.v1.scheduler"...  type=io.containerd.gc.v1
INFO[2020-02-22T11:09:04.609171800+08:00] loading plugin "io.containerd.service.v1.containers-service"...  type=io.containerd.service.v1
INFO[2020-02-22T11:09:04.628196600+08:00] loading plugin "io.containerd.service.v1.content-service"...  type=io.containerd.service.v1
INFO[2020-02-22T11:09:04.645164600+08:00] loading plugin "io.containerd.service.v1.diff-service"...  type=io.containerd.service.v1
INFO[2020-02-22T11:09:04.664083400+08:00] loading plugin "io.containerd.service.v1.images-service"...  type=io.containerd.service.v1
INFO[2020-02-22T11:09:04.670739700+08:00] loading plugin "io.containerd.service.v1.leases-service"...  type=io.containerd.service.v1
INFO[2020-02-22T11:09:04.689722900+08:00] loading plugin "io.containerd.service.v1.namespaces-service"...  type=io.containerd.service.v1
INFO[2020-02-22T11:09:04.705680600+08:00] loading plugin "io.containerd.service.v1.snapshots-service"...  type=io.containerd.service.v1
INFO[2020-02-22T11:09:04.724497600+08:00] loading plugin "io.containerd.runtime.v1.linux"...  type=io.containerd.runtime.v1
INFO[2020-02-22T11:09:04.743291500+08:00] loading plugin "io.containerd.runtime.v2.task"...  type=io.containerd.runtime.v2
INFO[2020-02-22T11:09:04.747424800+08:00] loading plugin "io.containerd.monitor.v1.cgroups"...  type=io.containerd.monitor.v1
INFO[2020-02-22T11:09:04.767781500+08:00] loading plugin "io.containerd.service.v1.tasks-service"...  type=io.containerd.service.v1
INFO[2020-02-22T11:09:04.783546000+08:00] loading plugin "io.containerd.internal.v1.restart"...  type=io.containerd.internal.v1
INFO[2020-02-22T11:09:04.803609700+08:00] loading plugin "io.containerd.grpc.v1.containers"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.806843900+08:00] loading plugin "io.containerd.grpc.v1.content"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.824845300+08:00] loading plugin "io.containerd.grpc.v1.diff"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.825514100+08:00] loading plugin "io.containerd.grpc.v1.events"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.844268300+08:00] loading plugin "io.containerd.grpc.v1.healthcheck"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.862309200+08:00] loading plugin "io.containerd.grpc.v1.images"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.868008900+08:00] loading plugin "io.containerd.grpc.v1.leases"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.868593000+08:00] loading plugin "io.containerd.grpc.v1.namespaces"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.887239600+08:00] loading plugin "io.containerd.internal.v1.opt"...  type=io.containerd.internal.v1
INFO[2020-02-22T11:09:04.904976000+08:00] loading plugin "io.containerd.grpc.v1.snapshots"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.909043500+08:00] loading plugin "io.containerd.grpc.v1.tasks"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.926997400+08:00] loading plugin "io.containerd.grpc.v1.version"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.927696200+08:00] loading plugin "io.containerd.grpc.v1.introspection"...  type=io.containerd.grpc.v1
INFO[2020-02-22T11:09:04.964084500+08:00] serving...                                    address="/var/run/docker/containerd/containerd-debug.sock"
INFO[2020-02-22T11:09:04.976438300+08:00] serving...                                    address="/var/run/docker/containerd/containerd.sock"
INFO[2020-02-22T11:09:04.995872500+08:00] containerd successfully booted in 0.449319s
INFO[2020-02-22T11:09:05.008892100+08:00] parsed scheme: "unix"                         module=grpc
INFO[2020-02-22T11:09:05.011750500+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-02-22T11:09:05.033549900+08:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-02-22T11:09:05.051284400+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-02-22T11:09:05.055568500+08:00] parsed scheme: "unix"                         module=grpc
INFO[2020-02-22T11:09:05.055766700+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-02-22T11:09:05.073081000+08:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-02-22T11:09:05.090749400+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-02-22T11:09:05.104871000+08:00] [graphdriver] using prior storage driver: overlay2
WARN[2020-02-22T11:09:05.152741200+08:00] Your kernel does not support cgroup memory limit
WARN[2020-02-22T11:09:05.153377200+08:00] Unable to find cpu cgroup in mounts
WARN[2020-02-22T11:09:05.153980700+08:00] Unable to find blkio cgroup in mounts
WARN[2020-02-22T11:09:05.154573200+08:00] Unable to find cpuset cgroup in mounts
WARN[2020-02-22T11:09:05.155169600+08:00] mountpoint for pids not found
INFO[2020-02-22T11:09:05.155932100+08:00] Loading containers: start.
WARN[2020-02-22T11:09:05.160351700+08:00] Running iptables --wait -t nat -L -n failed with message: `iptables v1.6.1: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.`, error: exit status 3
INFO[2020-02-22T11:09:05.234905500+08:00] stopping event stream following graceful shutdown  error="<nil>" module=libcontainerd namespace=moby
INFO[2020-02-22T11:09:05.235118300+08:00] stopping healthcheck following graceful shutdown  module=libcontainerd
INFO[2020-02-22T11:09:05.235126900+08:00] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=plugins.moby
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 v1.6.1: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
 (exit status 3)

我在这里完全迷失了方向,并且缺乏修复问题的背景知识--我正在上一门web dev课程,这是很多东西/练习的必修课。谢谢!

EN

回答 2

Stack Overflow用户

发布于 2020-06-11 05:47:52

不能在Windows Subsystem for Linux下运行Docker。Docker依赖于许多WSL没有实现的Linux内核特性。你的名字在评论中看起来是这样的:

代码语言:javascript
复制
Linux DESKTOP-CD69S60 4.4.0-17763-Microsoft #864-Microsoft Thu Nov 07 15:22:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux

17763-Microsoft是关键部分--这意味着您实际上并没有运行Linux内核,而是在运行WSL内核(它近似于Windows NT上的Linux )。

您需要使用WSL2 (它运行的是真正的虚拟机,而不是部分兼容Linux的内核)或其他虚拟化技术,如VMware、Hyper-V或VirtualBox。如果你安装了Hyper-V,由于Hyper-V的工作方式,VMware和VirtualBox都不是可选的,所以如果你发现Hyper-V不能满足你的需求,你需要像Hyper-V Switcher这样的东西来关闭它(然后其他虚拟化技术就可以工作了)。

票数 0
EN

Stack Overflow用户

发布于 2020-02-22 15:47:16

您必须将用户添加到docker组。

示例:

代码语言:javascript
复制
usermod -g  docker username

然后,您将能够连接。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60348724

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档