jam*_*iet 3 docker windows-subsystem-for-linux debian-buster wsl-2
我正在尝试在 Windows Subsystem for Linux (WSL) 2(在 Windows Home build 19033.1 上运行)上安装 docker。我按照https://learn.microsoft.com/en-us/windows/wsl/wsl2-install上的说明安装了 wsl2 ,并从 Windows 应用商店安装了 debian,即 debian 10 (buster)。它正在 wsl 2 上运行,如下所示:
wsl -l -v
名称状态版本
* Debian 运行 2$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL=" https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
我按照https://linuxconfig.org/how-to-install-docker-on-debian-10-buster-linux上的说明安装 docker:
sudo apt install docker.io
sudo docker run hello-world
docker:无法连接到位于 unix:///var/run/docker.sock 的 Docker 守护进程。docker 守护进程是否正在运行?
查看 docker 是否正在运行:
sudo service docker status
[FAIL] Docker 未运行...失败!
所以我尝试重新启动 docker 守护进程:
$ sudo service docker restart
grep: /etc/fstab: 没有这样的文件或目录
[ ok ] 启动 Docker: docker.
发现另一篇关于 SO 的文章说我可以通过发布来解决这个问题:
须藤触摸/etc/fstab
这似乎有效(grep 错误不再出现):
$ sudo service docker restart
[ ok ] 启动 Docker:docker.
但我仍然遇到同样的问题:
$ sudo docker run hello-world
docker: 无法连接到位于 unix:///var/run/docker.sock 的 Docker 守护进程。docker 守护进程是否正在运行?
我查看了 docker 日志,里面充满了错误:
$ cat /var/log/docker.log | grep -i error
time="2019-11-28T21:48:51.725383200Z" level=warning msg="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"
time="2019-11-28T21:48:51.726777600Z" level=warning msg="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.19.84-microsoft-standard/modules.dep.bin'\\nmodprobe: FATAL: Module aufs not found in directory /lib/modules/4.19.84-microsoft-standard\\n\": exit status 1"
time="2019-11-28T21:48:51.726982500Z" level=warning msg="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"
time="2019-11-28T21:48:51.727010800Z" level=warning msg="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.19.84-microsoft-standard/modules.dep.bin'\\nmodprobe: FATAL: Module aufs not found in directory /lib/modules/4.19.84-microsoft-standard\\n\": exit status 1"
time="2019-11-28T21:48:51.727022700Z" level=warning msg="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"
time="2019-11-28T21:48:51.727031100Z" level=warning msg="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"
time="2019-11-28T21:48:51.744791900Z" level=warning msg="Running modprobe nf_nat failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.84-microsoft-standard/modules.dep.bin'\nmodprobe: WARNING: Module nf_nat not found in directory /lib/modules/4.19.84-microsoft-standard`, error: exit status 1"
time="2019-11-28T21:48:51.746095200Z" level=warning msg="Running modprobe xt_conntrack failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.84-microsoft-standard/modules.dep.bin'\nmodprobe: WARNING: Module xt_conntrack not found in directory /lib/modules/4.19.84-microsoft-standard`, error: exit status 1"
time="2019-11-28T21:48:51.768996800Z" level=info msg="stopping event stream following graceful shutdown" error="<nil>" module=libcontainerd namespace=moby
time="2019-11-28T21:48:51.769171500Z" level=info msg="stopping event stream following graceful shutdown" error="context canceled" module=libcontainerd namespace=plugins.moby
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables --wait -t nat -N DOCKER: iptables v1.8.2 (nf_tables): CHAIN_ADD failed (No such file or directory): chain PREROUTING
Run Code Online (Sandbox Code Playgroud)
有点不知道问题出在哪里。希望有人能给建议吗?
我遵循了下面 @sx-tan 的极好建议,他建议遵循https://kind.sigs.k8s.io/docs/user/using-wsl2/#updating-kernel中的说明。这些指令要求发出:
# This assumes Ubuntu or Debian, a different step may be needed for RPM based distributions
sudo apt install build-essential flex bison libssl-dev libelf-dev
git clone --depth 1 https://github.com/microsoft/WSL2-Linux-Kernel.git
cd WSL2-Linux-Kernel
make -j4 KCONFIG_CONFIG=Microsoft/config-wsl
mkdir /mnt/c/linuxtemp
cp arch/x86_x64/boot/bzImage /mnt/c/linuxtemp/
Run Code Online (Sandbox Code Playgroud)
不幸的是,这些命令不会产生与该cp命令期望的相同的目录结构。我没有arch/x86_x64/目录。我确实有一个arch/x86目录,但不包含boot/bzImage:
jamiet@DESKTOP-GA45TGH:/mnt/c/Users/jamie/git/github/microsoft/WSL2-Linux-Kernel$ ls arch/x86/boot/
a20.c code16gcc.h cpuflags.h install.sh pm.c string.h video.c
apm.c compressed ctype.h main.c pmjump.S tools video.h
bioscall.S copy.S early_serial_console.c Makefile printf.c tty.c video-mode.c
bitops.h cpu.c edd.c memory.c regs.c version.c video-vesa.c
boot.h cpucheck.c genimage.sh mkcpustr.c setup.ld vesa.h video-vga.c
cmdline.c cpuflags.c header.S mtools.conf.in string.c video-bios.c
Run Code Online (Sandbox Code Playgroud)
我按照确切的说明进行操作,因此只能猜测自https://kind.sigs.k8s.io/docs/user/using-wsl2/#updating-kernel编写以来,存储库已发生更改。如果有帮助,这里是目录arch:
jamiet@DESKTOP-GA45TGH:/mnt/c/Users/jamie/git/github/microsoft/WSL2-Linux-Kernel$ ls arch/
alpha arm c6x hexagon Kconfig microblaze nds32 openrisc powerpc s390 sparc unicore32 xtensa
arc arm64 h8300 ia64 m68k mips nios2 parisc riscv sh um x86
Run Code Online (Sandbox Code Playgroud)
还是希望有人能澄清一下。
小智 6
在此发帖以防其他人像我一样遇到此问题。这似乎与https://superuser.com/questions/1468316/which-kernel-moduules-are-really-needed-for-docker-installation有同样的问题
根据该答案,运行后:
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
Run Code Online (Sandbox Code Playgroud)
我能够开始启动 docker 服务。
| 归档时间: |
|
| 查看次数: |
2756 次 |
| 最近记录: |