docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.86k stars 290 forks source link

docker engine stopped after start docker desktop #14267

Open garylavayou opened 2 months ago

garylavayou commented 2 months ago

Description

The dashboard shows that "Docker Engine stopped" after starting docker desktop, cannot load anything related to containers.

Reproduce

  1. From Start Menu click Docker Desktop to start.

Expected behavior

The dashboard of Docker Desktop will show the contents of containers, images, etc..

docker version

Client:
 Version:           27.1.1
 API version:       1.46
 Go version:        go1.21.12
 Git commit:        6312585
 Built:             Tue Jul 23 19:57:57 2024
 OS/Arch:           windows/amd64
 Context:           desktop-linux
error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.46/version": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.

docker info

Client:
 Version:    27.1.1
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.16.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.34
    Path:     C:\Program Files\Docker\cli-plugins\docker-debug.exe
  desktop: Docker Desktop commands (Alpha) (Docker Inc.)
    Version:  v0.0.14
    Path:     C:\Program Files\Docker\cli-plugins\docker-desktop.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.25
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-feedback.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.3.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.11.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
ERROR: error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.46/info": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.
errors pretty printing info

Diagnostics ID

3AF8C900-1E3C-4A57-82FB-2AB4FC6C8BF3/20240819004144

Additional Info

Related logs

Logs from dockerd.log (in %LocalAppData%\Docker\log\vm\dockerd.log)

-------------------------------------------------------------------------------->8
time="2024-08-19T00:31:34.365459802Z" level=info msg="Starting up"
time="2024-08-19T00:31:34.444348218Z" level=info msg="Starting daemon with containerd snapshotter integration enabled"
time="2024-08-19T00:31:34.444434560Z" level=info msg="Loading containers: start."
time="2024-08-19T00:31:35.357257668Z" level=info msg="Removing stale sandbox 316633c7275375d42a5c6fea152f74ba70bf812f1cc133107b4e08147ce4f789 (12e64acb4c34b04b708dc97c91907ac9fe17940415f222b32cddcc3c5816aaa3)"
time="2024-08-19T00:31:35.388736011Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint 9fab5c953d8b7b66b80f58c1f04ee78e8cb98afad7ba95e0a45030bc0143d7af 8d3b767dcddd6297e2221c2f6698ccae080a792f7267118ad16809f9acb356b5], retrying...."
time="2024-08-19T00:31:35.403423963Z" level=info msg="Removing stale sandbox 3c98d4cf52f9141f255264638968437c4bb9eb59d040facd687e3b808a2673f3 (bef615aff10891bb14e8b77bdbb620daba4fc4f4345439b328f35afa05c4dfe2)"
time="2024-08-19T00:31:35.416411983Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint f612762be574826fc573337c8e11ebc004f758f90092771980a4dadb8efc807a 8a3090b10442016053223927c1ddf7f6e61600d2961632c7b2b17b44deb6c179], retrying...."
time="2024-08-19T00:31:35.431102469Z" level=info msg="Removing stale sandbox a05715201481324883adf7db938edea8e7ff859974710ea46f2828396f564b78 (986edbb47c140e21af00f3bc689afb8dc6f1579aab20e984f179994e51f3da98)"
time="2024-08-19T00:31:35.462801221Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint 9fab5c953d8b7b66b80f58c1f04ee78e8cb98afad7ba95e0a45030bc0143d7af e5fd129f9b376ba3260f7d60e5ba4e285abac15ab7aa87515d600eadffa7ad08], retrying...."
time="2024-08-19T00:31:35.476894200Z" level=info msg="Removing stale sandbox ed22162bc6959b8622f35d3abe0ff10840ce689f3c20d4be72754a07ffcc2a89 (be96da85178bd20db9b10bd78f68244588194eb87e64c69fc8771980bd7f8b5a)"
time="2024-08-19T00:31:35.499638567Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint e747fdd1dbfb15953a74d62ed0ea3a2aa2025dad382ed197b93df30739abc97b 240d58c594dac3d373da5214a9ef63de187384ff7ac7ebace37c760536a42804], retrying...."
time="2024-08-19T00:31:35.513964661Z" level=info msg="Removing stale sandbox 379e69a6c8b3c10f5cf8775091174459c13d34f45f7d16930446a7f4204f8d49 (6ce5ae0c94b8a9b34ed322cd598387dd1e244389028b8414862bb39d8fa593f4)"
time="2024-08-19T00:31:35.524382315Z" level=warning msg="Failed to clean up network resources on container coder-coder-traefik-1 disconnect: failed to set gateway while updating gateway: route for the gateway 192.168.200.1 could not be found: network is unreachable"
time="2024-08-19T00:31:35.537070624Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint 4306cace9fe375314ecdacbb84c1bac1321a67739767f2757d7068f88f4dce19 e2973ca19da1dc950ea58d9708e5385aa015e881ce4135790f73b74ae1cee2f7], retrying...."
time="2024-08-19T00:31:35.559286083Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint 9fab5c953d8b7b66b80f58c1f04ee78e8cb98afad7ba95e0a45030bc0143d7af 186d3e8f5f2dfa0f6166acdbfa1d406c309ef13b1eb4c540cbdad805a6f80113], retrying...."
(......similial logs omitted......)
time="2024-08-19T00:31:36.214947358Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
time="2024-08-19T00:31:36.300543470Z" level=warning msg="error locating sandbox id ed65de9b78106adf2c221e7ac5799350505db1723ef8e0ea5121895d17861ca8: sandbox ed65de9b78106adf2c221e7ac5799350505db1723ef8e0ea5121895d17861ca8 not found"
(......similial logs omitted......)
time="2024-08-19T00:31:40.522861957Z" level=info msg="Loading containers: done."
time="2024-08-19T00:31:40.537903978Z" level=warning msg="WARNING: daemon is not using the default seccomp profile"
time="2024-08-19T00:31:40.537982450Z" level=info msg="Docker daemon" commit=cc13f95 containerd-snapshotter=true storage-driver=overlayfs version=27.1.1
time="2024-08-19T00:31:40.538088271Z" level=info msg="Daemon has completed initialization"
context deadline exceeded
time="2024-08-19T00:31:55.623122430Z" level=info msg="stopping event stream following graceful shutdown" error="context canceled" module=libcontainerd namespace=plugins.moby
time="2024-08-19T00:31:55.623218359Z" level=info msg="stopping event stream following graceful shutdown" error="context canceled" module=libcontainerd namespace=moby
EOF

A long time after Docker Desktop showing that Docker Engine Stopped, the trobleshooting dialogue will prompt with the follow message entitled with An unexpected error occurred:

running engine: waiting for the Docker API: context deadline exceeded

update

  1. I have been switching to the containerd storage backend for several versions of docker desktop. Now, I tries to switch back to the default storage engine. Surprisingly, docker engine can be started normally. So, If this problem close related to the storage engine, though I have not found any obvious clue from the containerd logs.

  2. The issue is probably related to containerd failure, see the related logs. Related logs of containerd (C:\Users\gary\AppData\Local\Docker\log\vm\containerd.log)

    time="2024-08-30T00:58:39.719359178Z" level=info msg="shim disconnected" id=cd862bef32f3a78a06ac7f6cb6ec45d0c9d238727ef01cb8a48a6c86553c4945 namespace=moby
    time="2024-08-30T00:58:39.719832054Z" level=warning msg="cleaning up after shim disconnected" id=cd862bef32f3a78a06ac7f6cb6ec45d0c9d238727ef01cb8a48a6c86553c4945 namespace=moby
    time="2024-08-30T00:58:39.719848855Z" level=info msg="cleaning up dead shim" namespace=moby
    time="2024-08-30T00:58:39.720904191Z" level=info msg="shim disconnected" id=d5451d1f386d450990a72d8478119307918b8bf050a52eca6e371ed2e74d47a1 namespace=moby
    time="2024-08-30T00:58:39.720967939Z" level=warning msg="cleaning up after shim disconnected" id=d5451d1f386d450990a72d8478119307918b8bf050a52eca6e371ed2e74d47a1 namespace=moby
    time="2024-08-30T00:58:39.720980026Z" level=info msg="cleaning up dead shim" namespace=moby
    time="2024-08-30T00:58:39.734869728Z" level=warning msg="cleanup warnings time=\"2024-08-30T00:58:39Z\" level=warning msg=\"failed to read init pid file\" error=\"open /var/run/desktop-containerd/daemon/io.containerd.runtime.v2.task/moby/cd862bef32f3a78a06ac7f6cb6ec45d0c9d238727ef01cb8a48a6c86553c4945/init.pid: no such file or directory\" runtime=io.containerd.runc.v2\n" namespace=moby
    time="2024-08-30T00:58:39.736270991Z" level=error msg="copy shim log" error="read /proc/self/fd/48: file already closed" namespace=moby
    time="2024-08-30T00:58:39.739085555Z" level=warning msg="cleanup warnings time=\"2024-08-30T00:58:39Z\" level=warning msg=\"failed to read init pid file\" error=\"open /var/run/desktop-containerd/daemon/io.containerd.runtime.v2.task/moby/d5451d1f386d450990a72d8478119307918b8bf050a52eca6e371ed2e74d47a1/init.pid: no such file or directory\" runtime=io.containerd.runc.v2\n" namespace=moby
    time="2024-08-30T00:58:39.740396488Z" level=error msg="copy shim log" error="read /proc/self/fd/46: file already closed" namespace=moby

    The folders under \\wsl.localhost\docker-desktop-data\data\desktop-containerd\daemon\io.containerd.runtime.v2.task\moby are actually all empty. Hence, there is no init.pid.

    companion logs from dockerd.log:

    time="2024-08-30T01:12:00.716139441Z" level=debug msg="2024/08/30 01:12:00 WARNING: [core] [Channel #1 SubChannel #2] grpc: addrConn.createTransport failed to connect to {Addr: \"/run/containerd/containerd.sock\", ServerName: \"localhost\", Attributes: {\"<%!p(networktype.keyType=grpc.internal.transport.networktype)>\": \"unix\" }, }. Err: connection error: desc = \"transport: Error while dialing: dial unix:///run/containerd/containerd.sock: timeout\"" library=grpc
    time="2024-08-30T01:12:03.270088474Z" level=debug msg="2024/08/30 01:12:03 WARNING: [core] [Channel #1 SubChannel #2] grpc: addrConn.createTransport failed to connect to {Addr: \"/run/containerd/containerd.sock\", ServerName: \"localhost\", Attributes: {\"<%!p(networktype.keyType=grpc.internal.transport.networktype)>\": \"unix\" }, }. Err: connection error: desc = \"transport: Error while dialing: dial unix:///run/containerd/containerd.sock: timeout\"" library=grpc
borbiuk commented 2 months ago

the same issue

quarky42 commented 2 months ago

One of my team mates is having the same issue. His Docker Desktop v2.33.1 was working fine. He shutdown his computer, and after reboot it is producing that same message: "running engine: waiting for the Docker API: context deadline exceeded"

He has uninstalled Docker Desktop, deleted all Docker directories from ProgramData, %UserProfile%/.docker %UserProfile/AppData/Local and Roaming directories. He Reinstalled, and he has confirmed that his WSL installation is working properly and is up to date. The only thing he hasn't done is ripped Docker from the registry.

This error persists after performing almost all of the troubleshooting we can. He told me he saw where he could try to downgrade to 2.32 instead.

quarky42 commented 2 months ago

While trying to find a solution to this error, I found this and am going to try it later today. Linking here in case others who are having this error can connect to their docker-desktop WSL distribution and check this path as well before I get a chance to see if this is related or not: https://github.com/docker/desktop-linux/issues/231#issuecomment-2258052478

I would have expected a completely fresh install, especially given that we deleted everything docker related to have recreated the internal cert bundle.... but maybe something was left behind in WSL and that was what needed to be recreated.

Edit: Alternatively, you could uninstall Docker Desktop, run wsl --unregister <distribution name here> for each of your docker related distributions found when you list them: wsl -l -v, then reinstall Docker Desktop. Uninstalling Docker Desktop, deleting all of the left over directories.... that still wouldn't clear out anything wrong in the WSL distribution that is loaded.

garylavayou commented 2 months ago

I have been switching to the containerd storage backend for several versions of docker desktop. Now, I try to switch back to the default storage engine. Surprisingly, docker engine can be started normally. So, If this problem close related to the storage engine, though I have not found any obvious clue from the containerd logs.

garylavayou commented 2 months ago

I have been switching to the containerd storage backend for several versions of docker desktop. Now, I try to switch back to the default storage engine. Surprisingly, docker engine can be started normally. So, If this problem close related to the storage engine, though I have not found any obvious clue from the containerd logs.

The issue is probably related to containerd failure, see the related logs. Related logs of containerd (C:\Users\gary\AppData\Local\Docker\log\vm\containerd.log)

time="2024-08-30T00:58:39.719359178Z" level=info msg="shim disconnected" id=cd862bef32f3a78a06ac7f6cb6ec45d0c9d238727ef01cb8a48a6c86553c4945 namespace=moby
time="2024-08-30T00:58:39.719832054Z" level=warning msg="cleaning up after shim disconnected" id=cd862bef32f3a78a06ac7f6cb6ec45d0c9d238727ef01cb8a48a6c86553c4945 namespace=moby
time="2024-08-30T00:58:39.719848855Z" level=info msg="cleaning up dead shim" namespace=moby
time="2024-08-30T00:58:39.720904191Z" level=info msg="shim disconnected" id=d5451d1f386d450990a72d8478119307918b8bf050a52eca6e371ed2e74d47a1 namespace=moby
time="2024-08-30T00:58:39.720967939Z" level=warning msg="cleaning up after shim disconnected" id=d5451d1f386d450990a72d8478119307918b8bf050a52eca6e371ed2e74d47a1 namespace=moby
time="2024-08-30T00:58:39.720980026Z" level=info msg="cleaning up dead shim" namespace=moby
time="2024-08-30T00:58:39.734869728Z" level=warning msg="cleanup warnings time=\"2024-08-30T00:58:39Z\" level=warning msg=\"failed to read init pid file\" error=\"open /var/run/desktop-containerd/daemon/io.containerd.runtime.v2.task/moby/cd862bef32f3a78a06ac7f6cb6ec45d0c9d238727ef01cb8a48a6c86553c4945/init.pid: no such file or directory\" runtime=io.containerd.runc.v2\n" namespace=moby
time="2024-08-30T00:58:39.736270991Z" level=error msg="copy shim log" error="read /proc/self/fd/48: file already closed" namespace=moby
time="2024-08-30T00:58:39.739085555Z" level=warning msg="cleanup warnings time=\"2024-08-30T00:58:39Z\" level=warning msg=\"failed to read init pid file\" error=\"open /var/run/desktop-containerd/daemon/io.containerd.runtime.v2.task/moby/d5451d1f386d450990a72d8478119307918b8bf050a52eca6e371ed2e74d47a1/init.pid: no such file or directory\" runtime=io.containerd.runc.v2\n" namespace=moby
time="2024-08-30T00:58:39.740396488Z" level=error msg="copy shim log" error="read /proc/self/fd/46: file already closed" namespace=moby

The folders under \\wsl.localhost\docker-desktop-data\data\desktop-containerd\daemon\io.containerd.runtime.v2.task\moby are actually all empty. Hence, there is no init.pid.

companion logs from dockerd.log:

time="2024-08-30T01:12:00.716139441Z" level=debug msg="2024/08/30 01:12:00 WARNING: [core] [Channel #1 SubChannel #2] grpc: addrConn.createTransport failed to connect to {Addr: \"/run/containerd/containerd.sock\", ServerName: \"localhost\", Attributes: {\"<%!p(networktype.keyType=grpc.internal.transport.networktype)>\": \"unix\" }, }. Err: connection error: desc = \"transport: Error while dialing: dial unix:///run/containerd/containerd.sock: timeout\"" library=grpc
time="2024-08-30T01:12:03.270088474Z" level=debug msg="2024/08/30 01:12:03 WARNING: [core] [Channel #1 SubChannel #2] grpc: addrConn.createTransport failed to connect to {Addr: \"/run/containerd/containerd.sock\", ServerName: \"localhost\", Attributes: {\"<%!p(networktype.keyType=grpc.internal.transport.networktype)>\": \"unix\" }, }. Err: connection error: desc = \"transport: Error while dialing: dial unix:///run/containerd/containerd.sock: timeout\"" library=grpc