Docker desktop crash on start up in Windows 10
Asked Answered
M

7

13

I installed docker desktop on Windows 10 through 'Docker Desktop Installer'.

After installation I logged off and logged in. It crashes on start up after some time stating the message as below

Docker.Core.Backend.BackendDestroyException:
One or more errors occurred.
   at Docker.Core.Pipe.NamedPipeClient.<TrySendAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters)
   at Docker.Actions.DoStart(SynchronizationContext syncCtx, Boolean showWelcomeWindow, Boolean withNotifications)
   at Docker.Actions.<>c__DisplayClass26_0.<StartAsync>b__0()
   at Docker.ApiServices.TaskQueuing.TaskQueue.<>c__DisplayClass18_0.<.ctor>b__1()

  System.AggregateException:
  One or more errors occurred.
     at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
     at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
     at Docker.Backend.LifecycleClient.DockerStart()
     at Docker.Backend.ContainerEngine.Linux.DoStart(Settings settings, String daemonOptions, Credential credential)
     at Docker.Backend.ContainerEngine.Linux.Start(Settings settings, String daemonOptions, Credential credential)

     Docker.Core.HttpBadResponseException:
     unable to fetch daemon.json: Get http://unix/engine/daemon.json: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
        at Docker.Backend.HttpClientExtensions.<ParseResponseBodyAsJsonAsync>d__2`1.MoveNext()
     --- 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.Backend.HttpClientExtensions.<GetJsonAsync>d__0`1.MoveNext()

I uninstalled, re-started my PC and installed by selecting 'Windows Container'. Then after the restart checked on running docker. It started successfully. But when I switch to Linux containers it again fails with the same error message above.

Mayflower answered 11/3, 2020 at 7:1 Comment(2)
Do you have hypervisor enabled? Also are you sure you are not trying to run windows containers when you switch to Linux containers?Seclude
I run it as admin and resolved my issue.Biathlon
A
17

The main goal to fix this is:

  1. Press windows "start" button
  2. Enter by keyboard services + enter
  3. Find two of them : "Hyper-V Virtual Machine Management" and "Hyper-V Host Computer Service"
  4. (on each service)click mouse right-button, select "properties" and change in opened window "startup type" to "manual", then "ok" button.
  5. Click again on each mouse right-button and select start
  6. Press windows "start" button, enter "hyper-v", it will show you hyper manager, open it
  7. In hyper-v manager select "connect to server", from pop-up select "local computer"
  8. Run your desktop docker it is probably working now with no crashes and exceptions.
Apis answered 17/1, 2021 at 10:5 Comment(4)
I don't see Hyper-V Virtual Machine Management in my service list. Could you let me know how to fix in this situation?Gav
@DavidPiao Go to control panel and select 'Turn windows features on or off' then search for Hyper-v and under that enable Hyper-v services.Biathlon
Thanks! This fixed it for me. I had 3 crashes in a row this morning, and the crashes stopped after I tried your tip. It seems Microsoft did not include the Hyper-V Management Tools by default for recent Windows 10 installs, which is easily fixed in Turn Windows Features On or Off by enabling Hyper-V > Hyper-V Management Tools.Vi
@JalilMarkel Not all computers can run Hyper-V, specifically older computers with old CPU architecture that don't support SLAT. Check if your CPU supports SLAT for it is required to run Hyper-V. If not, use WSL2 instead.Canicula
L
1
  1. Click on the Start button
  2. Then type services
  3. Search for Docker Desktop Services.
  4. Click on that
  5. On the top left click on stop service
  6. Then click on start service.

now open windows powershell as administrator
type docker
this will show you the list of commands
after that type docker images
this will show you the following error

error during connect: This error may indicate that the docker daemon is not running.

After that run this command

& 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon

and then run the following command

docker images

This will solve your problems

Laughton answered 25/2, 2021 at 8:25 Comment(1)
This had no effect. Plus it would be helpful to know what this is supposed to do and why it should help.Thrifty
M
0

What helps is already given in the other answers, i just try to be more specific and try to avoid some traps by using Environment-Variables in the paths and append some details and reasoning for the core problem:

First of all, make sure the "Docker Desktop Service" is running, which should be the case once you logged out and in again directly after install or rebooted the system. To check the status of services do either click/press/touch the Start-Button/Windows-Key to initiate the integrated Desktop-Search and type:

services

or type

services.msc

in either the desktop-search as stated before, or open the Run-dialog by pressing and holding down the "Windows-Key" and the "R"-key right after it as well, then release the keys. In the "Run-Dialog" type

services.msc

Use the command-line-interface (CLI)-tool "DockerCli.exe" with the attribute/option "SwitchDaemon". For this you need to open a command-line, either PowerShell or CommandShell, you do this by either click/press/touch the Start-Button/Windows-Key to initiate the integrated Desktop-Search and type:

cmd

for the CommandShell, or for the PowerShell:

powershell

or you type "cmd.exe" or "powershell.exe" in either the Desktop-Search as stated before, or you

open the Run-dialog by pressing and holding down the "Windows-Key" and the "R-Key" right after it as well, then release the keys. In the "Run-Dialog" type "cmd.exe" or "powershell.exe".

To actually switch the Docker-Service operation-mode use the following:

If you are in the Command-Shell/cmd.exe type:

cmd -C "%ProgramFiles%\Docker\Docker\DockerCli.exe -SwitchDaemon"

Or if you are in PowerShell type:

& "Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon"

If all that is too complex for you and you want to try a "fire&forget"-approach - relying on the assumption that the Docker-Desktop-Service is indeed running, because you either logged out and back in after install or you already rebooted your system, you may use the Run-Dialog (to open via Win+R) and paste the following line:

powershell.exe & "$Env:ProgramFiles/Docker/Docker/DockerCli.exe -SwitchDaemon"

This will work because it explicitly executes the PowerShell (which is part of Windows 10 and Docker Desktop only runs on Windows 10) and passes to it the command DockerCli.exe -SwitchDaemon.The path is determined via the System-Environment-Variable ProgramFiles which will resolve to your System-Root and Program-Files directory (in most cases "C:\Program Files", but can also be on a manually set drive-letter, e.g. "B:" (which is often used on embedded systems to prevent automatic creation of swap-files), so on "B:\Program Files" in that case.

It relies on the standard install-path of Docker Desktop on Windows 10 systems, if you changed it you have to adjust the path accordingly. You will have no feedback. Just start "Docker Desktop" from your Start-Menu after you pasted and executed the command from the Run-Dialog.

The path in all examples is set in quotes ("") to guarantee that it can be executed. This would be a necessity as well if you for example want to prepare a Shortcut on the Desktop for first use after deployment, e.g. titled "Run this once (if Docker Desktop fails to start)". This way you can make it part of an image with Docker preinstalled.

Be aware that the main problem is that Docker uses WSL2 to provide its Linux-based containers (on Windows 10 Home exclusively) and that to run Windows-Containers Hyper-V needs to be enabled, sadly the latter contradicts with WSL2 on Windows 10 Desktop operating systems. You can enable Hyper-V afterwards, together with Virtual-Machine-Services and Windows-Containers via Windows 10 Features, but it is not guaranteed it will work toegther with WSL2.

Marrufo answered 28/5, 2021 at 17:50 Comment(0)
T
0

The solution for me was to enable virtualization for my CPU in my computer's BIOS. Docker relies on virtualization to make containers work. For me, when it was disabled, Docker Desktop kept crashing and restarting and unhelpfully giving me very little information.

Here's a helpful page with some details on how to enable virtualization: https://bce.berkeley.edu/enabling-virtualization-in-your-pc-bios.html

The short instructions are:

  1. Reboot your computer.
  2. Press DEL or F2 or whatever it is for your computer to get into the BIOS.
  3. Look for CPU settings, then find something called VT-x, AMD-V, SVM, or Vanderpool. Enable it.
  4. Save settings and restart your computer.
Thrifty answered 27/6, 2022 at 0:28 Comment(0)
H
0

You should be open Hyper-V section.Docker doesn't work without Hyper-V.

How to open Hyper-V section:

  1. Right click on the Windows button and select 'Apps and Features'.
  2. Select Programs and Features on the right under related settings.
  3. Select Turn Windows Features on or off. Select Hyper-V and click OK.
Ho answered 16/7, 2022 at 1:0 Comment(0)
M
0

The FIX IS SIMPLE...

If you are using Docker Desktop for Windows, go to the System Tray in the lower right corner of your Windows screen, right-click the docker whale icon, and in the Docker settings popup choose Switch to Windows containers...

enter image description here

You cannot use the Linux Containers unless you install and are running a Linux Container host VM like Moby VM running under HyperVisor and also install and run the Docker Daemons and all its dependencies.

I would just use Windows Containers. Otherwise, you are looking at a larger setup on your Windows computer.

Monarchal answered 13/1, 2023 at 5:35 Comment(0)
P
-2

Updating my Windows version seems to fix this problem. I had the same error, but after updating Windows, Docker is working like a charm.

Puzzler answered 13/3, 2020 at 14:55 Comment(2)
Welcome to Stack Overflow! Please reserve a time to read the about page and visit the how to write a good answer in order to help, not only the user who asked the question, but many more that have similar issues.Ftc
Which version of Windows are you using to fix this problem? if you don't know, open a cmd.exe and type winver.Ftc

© 2022 - 2024 — McMap. All rights reserved.