[英]Problem installing/running Docker on Ubuntu (dockerd errors) / Daemons running? Kernel upgarde?
我在 Ubuntu 18.04(運行模擬 Windows)上,我是個新手。 我按照以下步驟安裝 Docker,但無法run
。
我用來安裝的命令( https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04 ):
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 訪問和下載圖像,我運行:
sudo docker run hello-world
我收到以下錯誤:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
運行sudo dockerd
返回:
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)
我完全迷失在這里並且缺乏解決問題的背景 - 我正在參加網絡開發課程,這是很多東西/練習的要求。 謝謝!
您不能在適用於 Linux 的 Windows 子系統下運行 Docker。 Docker 依賴於 WSL 尚未實現的許多 Linux 內核功能。 您的 uname 從評論中看起來像這樣:
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 之類的工具將其關閉。需求(然后其他虛擬化技術將起作用)。
您必須將用戶添加到 docker 組。
例子:
usermod -g docker username
然后,您將能夠連接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.