<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 才能生效

相关推荐
乌托邦的逃亡者21 分钟前
Docker的/var/lib/docker/目录占用100%的处理方法
运维·docker·容器
ldj202026 分钟前
Jenkins 流水线配置
运维·jenkins
古希腊数通小白(ip在学)3 小时前
stp拓扑变化分类
运维·服务器·网络·智能路由器
OKUNP4 小时前
Docker高级管理--容器通信技术与数据持久化
docker·容器·php
12点一刻5 小时前
搭建自动化工作流:探寻解放双手的有效方案(2)
运维·人工智能·自动化·deepseek
未来之窗软件服务5 小时前
东方仙盟AI数据中间件使用教程:开启数据交互与自动化应用新时代——仙盟创梦IDE
运维·人工智能·自动化·仙盟创梦ide·东方仙盟·阿雪技术观
o不ok!6 小时前
Linux面试问题-软件测试
linux·运维·服务器
用户6855449692738 小时前
第一周作业
docker
宇钶宇夕9 小时前
SIMATIC S7-1200的以太网通信能力:协议与资源详细解析
运维·服务器·数据库·程序人生·自动化