An unexpected error was encountered while executing a WSL command. Common ca

最近自己在windows上安装Docker时一直提示报错

An unexpected error was encountered while executing a WSLcommand. Common causes include access rights issues, which occurafter waking the computer or not being connected to your domain/active directory. Please try shutting WSL down (wsl --shutdown) and/or rebooting yourcomputer. If not sufficient, WSL may need to be reinstalled fully. As alast resort, try to uninstall/reinstall Docker Desktop. lf the issue persistsplease collect diagnostics and submit an issue (https://docs.docker.com/desktop/troubleshoot/overview/#diagnose-from-theterminal). Error details:2 errors occurred:

搜了很多答案都没有解决,最后找到问题原因是我的新电脑没有开虚拟化,真的折磨了我好久都没想到会是这个原因,这里把可能的原因整理一下给大家提供一下解决问题的思路:

1、开了梯子 更新WSL
解决方案:管理员权限打开cmd或者powershell
执行命令:

netsh winsock reset

重启电脑

2、没有安装wsl 或者版本有问题 或者服务没有启动
执行:

wsl.exe --list

可以查看自己是否安装了wsl
如果提示:

适用于 Linux 的 Windows 子系统没有已安装的分发。
使用 ‘wsl.exe --list --online’ 列出可用的分发
并使用 ‘wsl.exe --install ’ 进行安装。

就是没有正确安装
可以根据提示执行

wsl.exe --list --online

之后在列表中选一个安装就可以,例如

wsl.exe --install Ubuntu

3、检查一下自己的电脑主板有没有开启虚拟化的功能
表现为启动WSL时提示报错
正在启动 Ubuntu 22.04 LTS…
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

这个报错 表明WSL 注册分发失败,并提醒你启用虚拟机平台功能并确保 BIOS 中启用了虚拟化
参考链接 https://aka.ms/enablevirtualization检查自己电脑是否开启了虚拟化的功能,每个型号和厂家生产的主板开启虚拟化的设置不相同,这个就需要你自己去查找一下如何开启了

最后祝大家都能顺利启动Docker Desktop

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值