<OS 有关> Docker.Desktop - Unexpected WSL error #14030 不能启动, 问题已经解决 fixed

Windows Docker.Desktop 想用时报错:

"deploying WSL2 distributions ensuring main distro is deployed: deploying "docker-desktop": importing WSL distro "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\\r\\nError code: Wsl/Service/RegisterDistro/CreateVm/HCS/HCS_E_HYPERV_NOT_INSTALLED" output="docker-desktop": exit code: 4294967295: running WSL command wsl.exe C:\WINDOWS\System32\wsl.exe --import docker-desktop <HOME>\AppData\Local\Docker\wsl\main C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar --version 2: 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/RegisterDistro/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."

以上是我看到的报错信息。 【重排一下段落,添加下面一段 on 7oct24 pm]

这个case发现到写完这个doc已经用了数小时,在 GOOGLE 里看了一下,绝大部分"Enable "Virtual Machine Platform" by running: wsl.exe --install --no-distribution" 有这段话的 wsl2 有关的报错,其实都是 WSL2 不能启动,有可能是 Hyper-V 被OS禁用,或是 WSL 2 没有安装 Ubuntu 内核 DD 无法调用Linux, 用下面的方法都应该能解决的。

分析:

为什么会这样?

跟我禁用Hyper-V有关???

之前我在给VM添加VT-x时,曾用命令:

复制代码
bcdedit /set hypervisorlaunchtype off

禁用了 Hyper-V 这个虚拟化功能,因为它与VT-x冲突。

参见:我另一篇文章:

<OS有关> 升级 Windows 10 到 Windows 11 in VMware Workstations 16pro_vm16升17-CSDN博客文章浏览阅读600次,点赞14次,收藏9次。windows10 升级 windows 11 在vmware workstation 16上_vm16升17https://blog.csdn.net/davenian/article/details/142502104

很好奇

Docker.Desktop是用WSL 2(理解为一个虚拟机,在运行Ubuntu)

Docker.Desktop x86_64 安装版,是有 WSL2Hyper-V 两个版本, 我下载的是前者, 我理解WSL2是不支持Hyper-V., 在它的文档也有体现。

Docker.Desktop x86 下载位置:

https://docs.docker.com/desktop/install/windows-install/#system-requirementshttps://docs.docker.com/desktop/install/windows-install/#system-requirements

Dockers.Desktop 虚拟化设置的要求:

Common topics | Docker DocsExplore common troubleshooting topics for Docker Desktophttps://docs.docker.com/desktop/troubleshoot/topics/#virtualization所以我禁用了 Hyper-v在OS层面上。

解决方法:

什么是WSL 2?

Windows Subsystem for Linux 2, 这个是第二版,WSL是Microsoft 提供的一种功能,它允许用户在 Windows 系统上运行原生的 Linux 内核和 Linux 应用程序。

如何安装 WSL 2

powershell 以管理员运行

复制代码
wsl --install

可以看到, 安装 有Ubuntu, 如果没有,只是一闪返回,可以尝试手动安装 Ubuntu, 命令如下:

复制代码
wsl --install -d Ubuntu 

现在我理解为:Docker.Desktop就是要用到Ubuntu系统运行来模拟Linux,WSL 2是虚拟化系统,功能等同于Vmware workstation,就是精简。

必须有的Windows 功能清单

  1. Virtual Machine Platform
  2. Windows Subsystem for Linux
  3. BIOS 启用 CPU 的虚拟化

optionalfeatures 命令

打开 Windows Features 菜单,在这里红框内的必须安装。 我测试时,也"勾选"了Hyper-V(绿框)可以不用。

在上面的第三个链接有提到 "Hypervisor enabled at Windows startup", 我之前已经禁用 Hyper-V, 那再启用它:

复制代码
bcdedit /set hypervisorlaunchtype auto

总结:

因为在Windows 11上关闭了 Hyper-V,造成WSL 2不能启动。 网上找有注销 WSL 再启动D.D,还有看报错内容提示: wsl.exe --install --no-distribution 安装WSL,而不附带Linux,显然都不行。

检查清单:

  1. BIOS 打开 虚拟化
  2. Hyper-V 不能在OS上禁用
  3. WSL安装后,要有Ubuntu

以上 是以Docker.Desktop x86_64 WSL 安装版本为例的。

对了,看系统有没有启用虚拟化看"系统的任务管理器 / Task manager" 绿框部分

结果

如启用了 Hyper-V, Vmware workstaion 里的是虚拟机们,就不能用 VT-x 这些虚拟化加持, 要做个取舍。

我?拿出一个VM跑 Docker.Desktop,我还有NAS 上面也有Docker/Container.。

在CMD里 as administor, 果断执行: bcdedit /set hypervisorlaunchtype off 重启电脑。

以上都是涉及到系统层面的修改,都需要重启Windows 才能生效

相关推荐
fetasty5 小时前
rustfs加picgo图床搭建
docker
蝎子莱莱爱打怪20 小时前
GitLab CI/CD + Docker Registry + K8s 部署完整实战指南
后端·docker·kubernetes
碳基沙盒1 天前
OpenClaw 多 Agent 配置实战指南
运维
小p2 天前
docker学习7:docker 容器的通信方式
docker
小p2 天前
docker学习5:提升Dockerfile水平的5个技巧
docker
小p2 天前
docker学习3:docker是怎么实现的?
docker
小p3 天前
docker学习: 2. 构建镜像Dockerfile
docker
小p4 天前
docker学习: 1. docker基本使用
docker
蝎子莱莱爱打怪4 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
崔小汤呀4 天前
Docker部署Nacos
docker·容器