[英]WSL Ubuntu 20.04, The command 'docker' could not be found in this WSL 2 distro
I'm having an issue with running Docker commands in Ubuntu 20.04 on WSL.我在 WSL 上的 Ubuntu 20.04 中运行 Docker 命令时遇到问题。
I followed the official documentation to setup Docker and run it with Ubuntu on WSL distribution.我按照官方文档设置 Docker 并在 WSL 分发版上使用 Ubuntu 运行它。
Now, I want to do the same in another distribution, Ubuntu 20.04.现在,我想在另一个发行版 Ubuntu 20.04 中执行相同的操作。
Here is what I have tried so far:到目前为止,这是我尝试过的:
Using PowerShell with admin privileges, Ubuntu 20.04 is shown and set as the default, according to the Docker docs :根据Docker文档,使用具有管理员权限的 PowerShell,显示 Ubuntu 20.04 并将其设置为默认值:
wsl.exe -l -v wsl.exe --set-version Ubuntu-20.04 2 wsl.exe --set-default-version 2
With Docker desktop application, Resources --> WSL Integration , Ubuntu-20.04
is added and Docker restarted and shown as active.使用 Docker 桌面应用程序, Resources --> WSL Integration ,添加
Ubuntu-20.04
并重新启动 Docker 并显示为活动状态。
In the regular Ubuntu WSL distribution, I get the following:在常规的 Ubuntu WSL 分发中,我得到以下信息:
george@DESKTOP-P9I14LM:~$ ls -l /mnt/wsl/docker-desktop/cli-tools/usr/bin total 158574 -rwxr-xr-x 1 root root 60513128 May 12 2022 com.docker.cli -rwxr-xr-x 1 root root 60178432 May 31 2022 docker -rwxr-xr-x 1 root root 6348800 May 31 2022 docker-compose -rwxr-xr-x 1 root root 12737304 May 31 2022 docker-compose-v1 -rwxrwxr-x 1 root root 9395712 May 31 2022 docker-credential-desktop.exe -rwxr-xr-x 1 root root 13205504 May 31 2022 hub-tool
While on Ubuntu-20.04 I get No such file or directory
.在 Ubuntu-20.04 上,我得到
No such file or directory
。
On Ubuntu 20.04:在 Ubuntu 20.04:
george@DESKTOP-P9I14LM:~$ ls -la /usr/bin/docker lrwxrwxrwx 1 root root 48 Dec 4 12:52 /usr/bin/docker -> /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker george@DESKTOP-P9I14LM:~$ ls /mnt/wsl/docker-desktop/cli-tools/usr/bin/ ls: cannot access '/mnt/wsl/docker-desktop/cli-tools/usr/bin/': No such file or directory
Am not familiar with this kind of issues, so please let me know in comments if there is any missing info I should add.我不熟悉这类问题,所以如果有任何遗漏的信息我应该补充,请在评论中告诉我。
I would recommend you to install Virtual Box and download an Ubuntu virtual machine there.我建议您安装 Virtual Box 并在那里下载一个 Ubuntu 虚拟机。 You would save yourself a lot of trouble.
你会省去很多麻烦。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.