连接错误:此错误可能表示 Docker 守护进程未运行。(http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.41/containers/json)
error during connect: This error may indicate that the docker daemon is not running. (http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.41/containers/json)
ID: docker/docker-daemon-not-running-wsl2
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Docker Desktop 4.20.0 | active | — | — | — |
| Docker Desktop 4.21.1 | active | — | — | — |
| WSL2 kernel 5.15.90.1 | active | — | — | — |
| Windows 10 22H2 | active | — | — | — |
| Windows 11 23H2 | active | — | — | — |
根因分析
当 WSL2 集成配置错误或 WSL2 内核过时时,适用于 Windows 的 Docker Desktop 无法启动守护进程。
English
Docker Desktop for Windows fails to start the daemon when WSL2 integration is misconfigured or the WSL2 kernel is outdated.
官方文档
https://docs.docker.com/desktop/troubleshoot/topics/#wsl-2-integration解决方案
-
通过以管理员身份运行的 PowerShell 执行 'wsl --update' 更新 WSL2 Linux 内核,然后重启 Docker Desktop。
-
在 Docker Desktop 中禁用并重新启用 WSL2 集成:设置 > 资源 > WSL 集成 > 关闭所有发行版,应用,然后重新打开所需发行版并重启。
-
在 %USERPROFILE%\.wslconfig 中手动设置 WSL2 内核路径,例如 'kernel=C:\\path\\to\\kernel',然后执行 'wsl --shutdown' 并重启 Docker Desktop。
无效尝试
常见但无效的做法:
-
Restarting Docker Desktop from the system tray
65% 失败
If the underlying WSL2 integration is broken or kernel is outdated, restarting Docker Desktop alone does not fix the issue; the daemon will fail again immediately.
-
Reinstalling Docker Desktop entirely
80% 失败
The error is often caused by a stale WSL2 kernel or misconfigured .wslconfig, not by Docker Desktop installation files. Reinstalling is time-consuming and rarely resolves the root cause.
-
Running 'wsl --shutdown' and then restarting Docker
55% 失败
While this can temporarily clear state, it does not update the WSL2 kernel or fix integration settings; the error returns after the next system reboot.