首先是之前一直可以使用的,这个docker,后来不知道怎么滴就突然不行了,困扰了好久,问题排查:
1、BOIS中确实已经开启了虚拟化支持功能
2、Hyper-V 功能已启用
3、wsl安装虚拟环境的时候,也一直卡在下面这里:
wsl --install
Ubuntu 已安装。
正在启动 Ubuntu...
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS. For information please visit https://aka.ms/enablevirtualization
Press any key to continue...
操作成功完成。
后面试过很多方法,最终靠强制重启大法成功了:
强制修复 Hyper-V 和 WSL2 配置
有时系统配置可能被损坏,导致 Hyper-V 和 WSL2 无法正确启动。可以尝试重置 Hyper-V 和 WSL2 环境。
步骤:重置 Hyper-V 和 WSL2
1、禁用 Hyper-V 和虚拟机平台功能:(powerSheel中管理员执行)
dism.exe /online /disable-feature /featurename:Microsoft-Hyper-V /norestart
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart
2、重启计算机。
3、重新启用 Hyper-V 和虚拟机平台:
dism.exe /online /enable-feature /featurename:Microsoft-Hyper-V /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
4、再次重启。
后面wsl的功能就正常了,能正常安装虚拟环境了,docker的启动也正常了,一切都回来了