简体   繁体   English

WSL Ubuntu 20.04,在此 WSL 2 发行版中找不到命令“docker”

[英]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:到目前为止,这是我尝试过的:

  1. 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
  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 并显示为活动状态。

  3. 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

  4. 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.

相关问题 Docker 始终运行 Frozen 或 WSL Ubuntu 发行版在等待生命周期服务器时停止 - Docker run always Frozen or WSL Ubuntu distro stopped while waiting for Lifecycle server 如何在 WSL 上安装 PyGears - Ubuntu 20.04 LTS - How to install PyGears on WSL - Ubuntu 20.04 LTS 为什么 Docker 无法在 Windows 10 Home 中检测到 WSL 2 发行版? - Why Docker can't detect WSL 2 distro in Windows 10 Home? 无法连接到 unix:///var/run/docker.sock 上的 Docker 守护进程。 docker 守护进程是否正在运行? (Ubuntu 20.04,WSL2) - Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Ubuntu 20.04 ,WSL2) 节点:找不到命令-在wsl bash - node: command not found - in wsl bash 将Docker Windows WSL Ubuntu连接到VMware Ubuntu - Connecting Docker Windows WSL Ubuntu to VMware Ubuntu WSL2 的 %USERPROFILE%\AppData\Local\Docker\wsl\distro\ext4.vhdx 文件中存储了什么? - What is stored in the %USERPROFILE%\AppData\Local\Docker\wsl\distro\ext4.vhdx file for WSL2? 无法从 WSL 2 Ubuntu 运行 docker compose - Unable to run docker compose from WSL 2 Ubuntu 如何在 Windows WSL Ubuntu 上安装 Homebrew,并修复“zsh: brew command not found”错误 - How to Install Homebrew on Windows WSL Ubuntu, and fix "zsh: brew command not found" error Build-Essential:在 WSL 上找不到命令 - Build-Essential: Command Not Found on WSL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM