Docker 在没有 Docker 桌面的 WSL2 Alpine 中
Docker in WSL2 Alpine without Docker Desktop
, so I'm trying to run Docker from within WSL2 Alpine by following this article.
但是我没那么幸运让它工作。下面包含完整日志。
有人知道哪里出了问题吗?
整个事情都是在alpine/v3.15
下完成的(安装自https://apps.microsoft.com/store/detail/alpine-wsl/9P804CRF0395?hl=en-us&gl=US)--
Downloading : https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/x86_64/alpine-minirootfs-3.15.0-x86_64.tar.gz
% apk del docker-cli docker-ce docker-openrc docker-compose docker
ERROR: No such package: docker-ce
% apk del docker-cli docker-openrc docker-compose docker
(1/17) Purging containerd-openrc (1.5.11-r2)
(2/17) Purging iptables-openrc (1.8.7-r1)
(3/17) Purging ip6tables-openrc (1.8.7-r1)
(4/17) Purging docker-openrc (20.10.16-r0)
(5/17) Purging docker (20.10.16-r0)
(6/17) Purging docker-engine (20.10.16-r0)
(7/17) Purging containerd (1.5.11-r2)
(8/17) Purging runc (1.1.2-r1)
(9/17) Purging ip6tables (1.8.7-r1)
(10/17) Purging tini-static (0.19.0-r0)
(11/17) Purging docker-cli (20.10.16-r0)
(12/17) Purging ca-certificates (20211220-r0)
Executing ca-certificates-20211220-r0.post-deinstall
(13/17) Purging libseccomp (2.5.2-r0)
(14/17) Purging iptables (1.8.7-r1)
(15/17) Purging libnftnl (1.2.1-r0)
(16/17) Purging libmnl (1.0.4-r2)
(17/17) Purging device-mapper-libs (2.02.187-r2)
Executing busybox-1.34.1-r3.trigger
OK: 11 MiB in 22 packages
% sudo apk add docker --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
-ash: sudo: not found
% apk add docker --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
(1/17) Installing ca-certificates (20211220-r0)
(2/17) Installing libseccomp (2.5.2-r0)
(3/17) Installing runc (1.1.2-r1)
(4/17) Installing containerd (1.6.4-r2)
(5/17) Installing containerd-openrc (1.6.4-r2)
(6/17) Installing libmnl (1.0.4-r2)
(7/17) Installing libnftnl (1.2.1-r0)
(8/17) Installing iptables (1.8.7-r1)
(9/17) Installing iptables-openrc (1.8.7-r1)
(10/17) Installing ip6tables (1.8.7-r1)
(11/17) Installing ip6tables-openrc (1.8.7-r1)
(12/17) Installing tini-static (0.19.0-r0)
(13/17) Installing device-mapper-libs (2.02.187-r2)
(14/17) Installing docker-engine (20.10.16-r0)
(15/17) Installing docker-openrc (20.10.16-r0)
(16/17) Installing docker-cli (20.10.16-r0)
(17/17) Installing docker (20.10.16-r0)
Executing docker-20.10.16-r0.pre-install
Executing busybox-1.34.1-r3.trigger
Executing ca-certificates-20211220-r0.trigger
OK: 238 MiB in 39 packages
% service docker restart
* WARNING: docker is already starting
% service docker status
* You are attempting to run an openrc service on a
* system which openrc did not boot.
* You may be inside a chroot or you may have used
* another initialization system to boot this system.
* In this situation, you will get unpredictable results!
* If you really want to do this, issue the following command:
* touch /run/openrc/softlevel
% touch /run/openrc/softlevel
touch: /run/openrc/softlevel: No such file or directory
% service openrc start
* service: service `openrc' does not exist
% service docker-openrc start
* service: service `docker-openrc' does not exist
您 可以 只是 运行 Docker 守护程序,如您链接到的博客 post 中所述:
sudo dockerd
然后切换到另一个 WSL Alpine 实例和 运行 Docker 客户端命令。
但是要使用 OpenRC Docker 服务,您有两个选择。
首先可以启动OpenRC,然后手动启动Docker服务:
openrc default
rc-service docker start # or service docker start
或者您可以将 Docker 服务添加到默认的 运行 级别 (one-time),然后每当 OpenRC 在该 运行等级:
One-time:
rc-update add docker default
然后,以默认 运行 级别启动 OpenRC,这也将 运行 Docker:
openrc default
真的,您似乎唯一缺少的是 OpenRC 没有首先初始化。通常,这会在 Alpine init 期间完成,但 WSL 自己的 /init
是 运行ning。
但是我没那么幸运让它工作。下面包含完整日志。
有人知道哪里出了问题吗?
整个事情都是在alpine/v3.15
下完成的(安装自https://apps.microsoft.com/store/detail/alpine-wsl/9P804CRF0395?hl=en-us&gl=US)--
Downloading : https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/x86_64/alpine-minirootfs-3.15.0-x86_64.tar.gz
% apk del docker-cli docker-ce docker-openrc docker-compose docker
ERROR: No such package: docker-ce
% apk del docker-cli docker-openrc docker-compose docker
(1/17) Purging containerd-openrc (1.5.11-r2)
(2/17) Purging iptables-openrc (1.8.7-r1)
(3/17) Purging ip6tables-openrc (1.8.7-r1)
(4/17) Purging docker-openrc (20.10.16-r0)
(5/17) Purging docker (20.10.16-r0)
(6/17) Purging docker-engine (20.10.16-r0)
(7/17) Purging containerd (1.5.11-r2)
(8/17) Purging runc (1.1.2-r1)
(9/17) Purging ip6tables (1.8.7-r1)
(10/17) Purging tini-static (0.19.0-r0)
(11/17) Purging docker-cli (20.10.16-r0)
(12/17) Purging ca-certificates (20211220-r0)
Executing ca-certificates-20211220-r0.post-deinstall
(13/17) Purging libseccomp (2.5.2-r0)
(14/17) Purging iptables (1.8.7-r1)
(15/17) Purging libnftnl (1.2.1-r0)
(16/17) Purging libmnl (1.0.4-r2)
(17/17) Purging device-mapper-libs (2.02.187-r2)
Executing busybox-1.34.1-r3.trigger
OK: 11 MiB in 22 packages
% sudo apk add docker --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
-ash: sudo: not found
% apk add docker --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
(1/17) Installing ca-certificates (20211220-r0)
(2/17) Installing libseccomp (2.5.2-r0)
(3/17) Installing runc (1.1.2-r1)
(4/17) Installing containerd (1.6.4-r2)
(5/17) Installing containerd-openrc (1.6.4-r2)
(6/17) Installing libmnl (1.0.4-r2)
(7/17) Installing libnftnl (1.2.1-r0)
(8/17) Installing iptables (1.8.7-r1)
(9/17) Installing iptables-openrc (1.8.7-r1)
(10/17) Installing ip6tables (1.8.7-r1)
(11/17) Installing ip6tables-openrc (1.8.7-r1)
(12/17) Installing tini-static (0.19.0-r0)
(13/17) Installing device-mapper-libs (2.02.187-r2)
(14/17) Installing docker-engine (20.10.16-r0)
(15/17) Installing docker-openrc (20.10.16-r0)
(16/17) Installing docker-cli (20.10.16-r0)
(17/17) Installing docker (20.10.16-r0)
Executing docker-20.10.16-r0.pre-install
Executing busybox-1.34.1-r3.trigger
Executing ca-certificates-20211220-r0.trigger
OK: 238 MiB in 39 packages
% service docker restart
* WARNING: docker is already starting
% service docker status
* You are attempting to run an openrc service on a
* system which openrc did not boot.
* You may be inside a chroot or you may have used
* another initialization system to boot this system.
* In this situation, you will get unpredictable results!
* If you really want to do this, issue the following command:
* touch /run/openrc/softlevel
% touch /run/openrc/softlevel
touch: /run/openrc/softlevel: No such file or directory
% service openrc start
* service: service `openrc' does not exist
% service docker-openrc start
* service: service `docker-openrc' does not exist
您 可以 只是 运行 Docker 守护程序,如您链接到的博客 post 中所述:
sudo dockerd
然后切换到另一个 WSL Alpine 实例和 运行 Docker 客户端命令。
但是要使用 OpenRC Docker 服务,您有两个选择。
首先可以启动OpenRC,然后手动启动Docker服务:
openrc default
rc-service docker start # or service docker start
或者您可以将 Docker 服务添加到默认的 运行 级别 (one-time),然后每当 OpenRC 在该 运行等级:
One-time:
rc-update add docker default
然后,以默认 运行 级别启动 OpenRC,这也将 运行 Docker:
openrc default
真的,您似乎唯一缺少的是 OpenRC 没有首先初始化。通常,这会在 Alpine init 期间完成,但 WSL 自己的 /init
是 运行ning。