容器运行时似乎不正常
.NET Aspire 需要 Docker(或 Podman)处于运行且正常状态。 本主题介绍你可能在 Docker 未处于正常状态时看到的可能出现的症状。
症状
启动 AppHost 时,仪表板不会显示,类似于此示例的异常堆栈跟踪将显示在控制台中:
info: Aspire.Hosting.DistributedApplication[0]
Aspire version: 8.1.0-dev
info: Aspire.Hosting.DistributedApplication[0]
Distributed application starting.
info: Aspire.Hosting.DistributedApplication[0]
Application host directory is: D:\aspire\playground\PostgresEndToEnd\PostgresEndToEnd.AppHost
fail: Microsoft.Extensions.Hosting.Internal.Host[11]
Hosting failed to start
Aspire.Hosting.DistributedApplicationException: Container runtime 'docker' was found but appears to be unhealthy. The error from the container runtime check was error during connect: this error may indicate that the docker daemon is not running: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.45/containers/json?limit=1": open //./pipe/docker_engine: The system cannot find the file specified..
可能的解决方案
确认已安装并运行 Docker:
- 在 Windows 上,检查系统托盘中是否有 Docker 图标,并确认它的状态为“正在运行”。
- 在 Linux,检查
docker ps -a
是否返回成功。