正如泰勒在他的评论中写道,您需要从 WSL 连接到 Docker 桌面。
在您附加的图像中有一个复选框 expose daemon on ...
Check this box.
现在您需要 docker cli,您可以安装 Linux vm,然后在刚才安装的 Linux vm 中安装 docker。
Then run which docker and copy this file to your windows computer.
Copy the docker executable into /usr/local/bin on your WSL.
现在在 WSL 中运行以下命令
Also, for docker into ubuntu, I enabled it in docker resources as a final step.
设置 > 资源 > WSL 集成。
译自: 美国《科学》杂志网站(href = “ https://docs.docker.com/docker-for-windows/wsl/”rel = “ nofollow norefrer”) https://docs.docker.com/docker-for-windows/wsl/
run wsl --list --verbose which will give you a list of your wsl running processes:
> wsl --list --verbose
NAME STATE VERSION
Ubuntu-20.04 Running 1
Then to switch it with wsl --set-version <your proc> 2:
> wsl --set-version Ubuntu-20.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.
> wsl docker --version
The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.
See https://docs.docker.com/docker-for-windows/wsl/ for details.