1. 确保勾选了 hyper-v 和 适用于 Linux 的 windows 子系统
2. 管理员运行 powershell, 挨个执行以下4个命令后,重启电脑
# 重新启用 WSL 和 VirtualMachine 功能:
DISM /online /enable-feature /featurename:VirtualMachinePlatform /norestart
DISM /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart
#重新启用 Hyper-V 功能:
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
bcdedit /set hypervisorlaunchtype auto
3. 重启后,顺利打开 docker 。
注:原报错如下:
Previously there was no errors; Now - error dialog is shown when starting the Docker Desktop:
provisioning docker WSL distros: ensuring main distro is deployed: checking if main distro is up to date: checking main distro bootstrap version: getting main distro bootstrap version: exit code: 4294967295: running WSL command wsl.exe C:\WINDOWS\System32\wsl.exe -d docker-desktop -u root -e wsl-bootstrap version: WSL2 is not supported with your current machine configuration.
Please enable the "Virtual Machine Platform" optional component and ensure virtualization is enabled in the BIOS.
Enable "Virtual Machine Platform" by running: wsl.exe --install --no-distribution
For information please visit https://aka.ms/enablevirtualization
Error code: Wsl/Service/CreateInstance/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED
: exit status 0xffffffff
checking if isocache exists: CreateFile \wsl$\docker-desktop-data\isocache: The network name cannot be found.