我在部署完成docker-desktop后,第二次开机启动时发生如下报错:
Docker Desktop - Unexpected WSL error An unexpected error occurred while executing a WSL command. Either shut down WSL down with wsl --shutdown, and/or reboot your machine. You can also try reinstalling WSL and/or Docker Desktop. If the issue persists, collect diagnostics and submit an issue .
deploying WSL2 distributions ensuring data disk is available: exit code: 4294967295: running WSL command wsl.exe C:\Windows\System32\wsl.exe --mount --bare --vhd your path\wsl\DockerDesktopWSL\disk\docker_data.vhdx: 无法将磁盘“\\?your path\Docker\wsl\DockerDesktopWSL\disk\docker_data.vhdx”附加到 WSL2: 拒绝访问。 错误代码: Wsl/Service/AttachDisk/MountVhd/HCS/E_ACCESSDENIED : exit status 0xffffffff checking if isocache exists: CreateFile \\wsl$\docker-desktop-data\isocache\: The filename, directory name, or volume label syntax is incorrect.
这种情况是没有给与your path\Docker\wsl\DockerDesktopWSL\disk\docker_data.vhdx文件镜像访问权力。
解决办法是:
- 鼠标右键docker_data.vhd,点击属性,点击共享,共享权限给你想要的用户或者管理员。
- 共享完成后,退出属性界面,重复鼠标右键docker_data.vhd,点击属性,发现共享变为安全,点击编辑,发现你所选择的用户已具备完全控制权。
- (这一步骤不知道是不是必须)打开powershell,输入命令
重启,再次打开docker-desktop发现问题解决。wsl --shutdown