每次开机docker-desktop都启动失败了

引言


启动报错提示为:“The attempted operation is not supported for the type of object referenced”,即“参考的对象类型不支持尝试的操作”。操作系统为中文的用户提示还可能为乱码,看也看不懂,这边也贴出来作为搜索关键词:�S ��v�[a�{|�W N/e c \Ջ�v�d\O 0 ,这个错误发生在版本比较新的docker-desktop中,使用WSL2作为基本引擎。

System.InvalidOperationException:
Failed to set version to docker-desktop: exit code: -1
 stdout: The attempted operation is not supported for the type of object referenced.

 stderr: 
   at Docker.ApiServices.WSL2.WslShortLivedCommandResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode) in C:\workspaces\PR-18120\src\github.com\docker\pinata\win\src\Docker.ApiServices\WSL2\WslCommand.cs:line 160
   at Docker.Engines.WSL2.WSL2Provisioning.<ProvisionAsync>d__8.MoveNext() in C:\workspaces\PR-18120\src\github.com\docker\pinata\win\src\Docker.Engines\WSL2\WSL2Provisioning.cs:line 81

 

正文


查阅资料时发现有很多人遇到,问题的原因解释为一个LSP DLL在WSL中加载调用失败引起的。解决办法很简单,只要防止WSL去加载这个LSP就可以了。

 

附上部分问题参考:

[SOLUTION] "The attempted operation is not supported for the type of object referenced." error after Windows Update #547 - MicrosoftDocs / WSL

win docker【�S ��v�[a�{|�W N/e c \Ջ�v�d\O 0】报错误 - User_undefined

WSL2启动时提示:参考的对象类型不支持尝试的操作 - fangye945a

 

本人也通过执行netsh winsock reset 重置winsock来临时解决这个问题,这个治标不治本,电脑重启后该报错还是得报错。

最终简单方便不易出错的方法就是下面这个了:

把下面的语句保存为注册表注册文件wsl.reg ,保存后执行把配置插入到注册表,成功注册后重启docker-desktop就可以了。

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\0408F7A3]
"AppFullPath"="C:\\Windows\\System32\\wsl.exe"
"PermittedLspCategories"=dword:80000000

 

posted @ 2022-06-15 21:30  zhuzhijie  阅读(2149)  评论(0编辑  收藏  举报