Windows 10更新后Docker Desktop无法启动(WSL2集成超时故障)
Windows 10更新后Docker Desktop无法启动(WSL2集成超时故障)
问题描述
早上Docker还正常运行,IT推送Windows更新后,Docker Desktop突然无法启动,但WSL2本身可以正常运行。报错核心是Ubuntu-20.04的WSL集成超时,完整错误日志如下:
Docker.Core.HttpBadResponseException: {"message":"1 error occurred:\n\t* starting WSL integration service: synchronising agents: starting added distros: 1 error occurred:\n\t* waiting for WSL integration for Ubuntu-20.04: timed out while polling for WSL distro integration to become ready in \"Ubuntu-20.04\"\n\n\n\n"} at Docker.Core.GoBackend.GoBackendClient.<PostNoBodyWithError>d__19.MoveNext() in C:\workspaces\4.16.x\src\github.com\docker\pinata\win\src\Docker.Core\GoBackend\GoBackendClient.cs:line 226 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__11.MoveNext() in C:\workspaces\4.16.x\src\github.com\docker\pinata\win\src\Docker.Engines\WSL2\LinuxWSL2Engine.cs:line 54 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() in C:\workspaces\4.16.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:line 29 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__6.MoveNext() in C:\workspaces\4.16.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 91 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__6.MoveNext() in C:\workspaces\4.16.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 118 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Docker.ApiServices.StateMachines.EngineStateMachine.<StartAsync>d__15.MoveNext() in C:\workspaces\4.16.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\EngineStateMachine.cs:line 72 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Docker.Engines.Engines.<StartAsync>d__23.MoveNext() in C:\workspaces\4.16.x\src\github.com\docker\pinata\win\src\Docker.Engines\Engines.cs:line 109
系统环境信息:
- Windows 10 Enterprise 22H2
- 安装日期:7/20/2022
- OS Build: 19045.2728
- Windows Feature Experience Pack: 120.2212.4190.0
解决方案
我之前处理过好几次Windows更新导致WSL2和Docker集成故障的情况,按以下步骤逐一尝试,大概率能解决问题:
1. 终止并重启WSL2 Ubuntu实例
首先彻底关闭Docker Desktop(右键托盘图标选择Quit Docker Desktop),然后打开管理员权限的PowerShell,执行以下命令:
# 终止Ubuntu-20.04实例 wsl --terminate Ubuntu-20.04 # 完全关闭WSL2 wsl --shutdown
等待10秒左右,再启动Ubuntu实例:
wsl -d Ubuntu-20.04
进入Ubuntu终端后输入exit退出,然后重新启动Docker Desktop试试。
2. 重新配置Docker的WSL集成
如果第一步无效,进入Docker Desktop的设置页面:
- 点击右上角设置图标 → Resources → WSL Integration
- 先取消勾选
Ubuntu-20.04,点击Apply & Restart - Docker重启完成后,再重新勾选
Ubuntu-20.04,再次点击Apply & Restart
这个操作会重置Docker和WSL之间的连接配置,很多超时问题都能通过这个解决。
3. 修复WSL2网络配置
Windows更新有时候会重置网络栈,导致WSL2和主机之间的通信异常。打开管理员PowerShell,执行以下命令重置网络:
netsh winsock reset netsh int ip reset ipconfig /release ipconfig /renew ipconfig /flushdns
执行完成后重启电脑,再尝试启动Docker。
4. 重置Docker到工厂默认状态(终极方案)
如果前面的步骤都没用,先备份好你的Docker镜像和容器(可以导出镜像到本地),然后:
- 进入Docker Desktop设置 → Troubleshoot → Reset to factory defaults
- 重置完成后,重新配置WSL集成,导入备份的镜像和容器
备注:内容来源于stack exchange,提问作者OldProgrammer




