docker wsl 2 没有安装

docker wsl 2 is not installed

安装 docker 桌面后,出现错误

错误 - 未安装 WSL 2。

当然,我试图解决这个问题。但我找到的所有解决方案都归结为我必须启用 Hyper-V。但是,我无法打开它,因为它在我的 windows 10 计算机上根本不存在,但我也无法下载它,因为默认情况下应该已经下载了它

每次我尝试通过控制台或其他方式启用 hyper-v 时,我都被告知它不在我的 PC 上。

以管理员身份登录,然后转到设置 -> 应用程序和功能 -> 程序和功能 -> 打开或关闭 Windows 功能 -> 激活 HyperV 和 WSL

或者Windows版本没有像Windows10 Home

那样提供Hyper V

[https://answers.microsoft.com/en-us/windows/forum/windows_10-windows_install-winpc/hyper-v-feature-did-not-available-in-window-10/de7b7a68-d060-4a44-ae4c-ed2119c834fa?auth=1][1]

对我有用的解决方案:

如果使用 Linux 容器,运行 命令提示符(管理员)中的以下内容:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

(if wsl 2 linux kernel is already installed, run the following as well)
wsl --set-default-version 2

如果使用 Windows 容器,运行 Powershell (Admin) 中的以下内容:

Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All