I have installed the Docker and then I have started the Docker. Docker says that "Docker is starting." Then,Docker says "Docker Failed to Start". Please, Could you help me?
Docker Error Detail:
System.InvalidOperationException:
Failed to deploy distro docker-desktop to C:\Users\---\AppData\Local\Docker\wsl\distro: exit code: -1
stdout: The operation could not be started because a required feature is not installed.
stderr:
at Docker.ApiServices.WSL2.WslShortLivedCommandResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode) in C:\workspaces\PR-15138\src\github.com\docker\pinata\win\src\Docker.ApiServices\WSL2\WslCommand.cs:line 146
at Docker.Engines.WSL2.WSL2Provisioning.<DeployDistroAsync>d__17.MoveNext() in C:\workspaces\PR-15138\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Provisioning.cs:line 169
--- 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.WSL2Provisioning.<ProvisionAsync>d__8.MoveNext() in C:\workspaces\PR-15138\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Provisioning.cs:line 78
--- 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__25.MoveNext() in C:\workspaces\PR-15138\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\LinuxWSL2Engine.cs:line 99
--- 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\PR-15138\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__5.MoveNext() in C:\workspaces\PR-15138\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\PR-15138\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 92
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Docker.Engines.Engines.<WaitCurrentTransitionsAsync>d__30.MoveNext() in C:\workspaces\PR-15138\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\Engines.cs:line 358
--- 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.<RestartAsync>d__26.MoveNext() in C:\workspaces\PR-15138\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\Engines.cs:line 250
In my scenario, I needed to install WSL 2 and my computer didn't have it.
Installing it made docker run successfully.
Try the below steps if you are installing docker for the first time.
First, we need to activate WSL from Windows.
Control Panel -> Programs -> Turn Windows features Turn On or Off
You need to check
Windows Subsystem For Linux
Windows Hypervisor Platform
Virtual Machine Platform
Then Click ok
After that, you need to Enable WSL 1 and update it to WSL 2 (https://learn.microsoft.com/en-us/windows/wsl/install-win10#manual-installation-steps)
To Install WSL 1 which comes built-in, open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
After that download the WSL 2 update from Microsoft. Use below this: WSL2 Linux kernel update package for x64 machines
After installing the above package, you need to set WSL 2 as the default version.
Open PowerShell as Administrator and run:
wsl --set-default-version 2
Now restart your computer. Now your docker should work.
Please note that to update to WSL 2, you must be running Windows 10.
For x64 systems: Version 1903 or higher, with Build 18362 or higher.
For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.
My Solution:
I have checked the Prerequisites for Docker. I have applied the second step in prerequisites. (Windows Subsystem for Linux Installation with Manual Installation Steps) It has fixed the error for me.
If you get an error like this (during this installation process):
WslRegisterDistribution failed with error: 0x80370114 Error: 0x80370114 The operation could not be started because a required feature is not installed. (I encountered this error.) Please, apply this.
These steps are quoted from the "this" named hyperlink above.
1. Open "Windows Security"
2. Open "App & Browser control"
3. Click "Exploit protection settings" at the bottom
4. Switch to "Program settings" tab
5. Locate "C:\WINDOWS\System32\vmcompute.exe" in the list and expand it
6. Click "Edit"
7. Scroll down to "Code flow guard (CFG)" and uncheck "Override system settings"
8. Start vmcompute from powershell "net start vmcompute"
9. Then go back and command wsl --set-default-version 2
I have fixed my problems like that. Good luck :)
Docker failed to start WSL 2 update
I just did this on powershell
wsl --install -d Ubuntu
wsl --update
wsl --shutdown
The problem is in WSL as it becomes unresponsive and returns a service error. Follow the below steps
1. Uncheck the Windows Subsystem for Linux in Windows Features
2. Restart
3. Turn the feature back on
4. Re-apply the WSL2 update
5. Restart
The combination of the above answer and installation of new destro worked for me
Uninstall existing installation
Install With Admin privilege
Restart
Follow the accepted answer here https://answers.microsoft.com/en-us/insider/forum/all/wsl-2-installing-linux-failed-error-code/bae391d1-4215-4d93-b0c4-3d96404a7c74
Install a linux destro follow this https://learn.microsoft.com/en-us/windows/wsl/install-win10#step-4---download-the-linux-kernel-update-package
Launch Linux desktop as admin
I was facing the same problem in my windows cooperate desktop. Unfortunately most of the windows settings changes are not available for users and controlled by IT team. What I did to make docker running is
Open Docker Desktop
Go to Settings
Turn off "Use the WSL 2 based engine" which switch to legacy Hyper-V
I know this is not ideal but atleast got docker working.
Fyi -- jprism's answer worked for me.
My issues were...
Docker install worked but would not start successfully, I got "WSL not installed" message.
Tried the WSL installation instructions from
https://learn.microsoft.com/en-us/windows/wsl/install
Default WSL installation was not found from PS session. Would not run from the command line without specifying the distro. Worked when I explicitly specified the default distro with the -d argument
Enabled WSL Subsystem as per https://www.windowscentral.com/install-windows-subsystem-linux-windows-10
Enabled all Hyper-V options in Control Panel > Programs and features > Turn Windows features on or off in addition WSL Subsystem
Finally as per jprism modified Docker settings to use Hyper-V
this can help you
& 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon
run this in powershell.
WSL2 cannot running.Reset winsock can fix it. Use following steps.
PS C:\WINDOWS\system32> wsl.exe --shutdown
PS C:\WINDOWS\system32> wsl.exe
The attempted operation is not supported for the type of object referenced.
PS C:\WINDOWS\system32> netsh winsock reset
Successfully reset the Winsock Catalog.
You must restart the computer in order to complete the reset.
After reboot ur system please run this command:
PS C:\WINDOWS\system32> wsl.exe
This will solve this error. I got it resolved at my machine.
Much much easier solution:
On Windows 11 with Docker Desktop v4.13.1 everything works fine with both Linux and Windows containers.
Than after a couple of restarts I suddenly get the same error (Docker failed to start etc.)
Click on Troubleshoot in the header menu. Here you can Clean / Purge data, after that it works again.
Uninstall Docker Desktop
Delete the following:
delete %appdata%\Docker*
delete %appdata%\Docker Desktop*
delete %LOCALAPPDATA%\Docker*
Reinstall Docker Desktop
Source
What fixed this for me was
Hit windows key, type "cmd", hit enter
Right click menu bar, select "Properties"
Uncheck "Use legacy console"
Related
So I'm trying to install Docker Desktop 4.13.1 on Windows 10 but I get this error after a while,
**Installation Failed**
Component CommunityInstaller.AutoStartAction failed: Access to the registry key 'HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' is denied.
at CommunityInstaller.InstallWorkflow.<DoHandleD4WPackageAsync>d__30.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 CommunityInstaller.InstallWorkflow.<DoProcessAsync>d__23.MoveNext()
I've tried disabling my antivirus software but that didn't help. I can't even find anything relating to this topic on the internet. I don't know how to provide the necessary permissions to Docker.
Is there any way I can fix this?
Alright, so after a lot of headbanging, I finally found a fix. This may not work for you but it's worth trying.
First, open command prompt and run,
wsl --status
If you get something like "you have an update," you're at the right place. Then run,
wsl --install -d ubuntu
Let it finish and then run,
wsl --update
Then reboot your system and open the docker installer again. It should install fine now.
I have been running Docker for the past 1 year on my work laptop. I recently started receiving requests to update the version. Ever since then, my Docker Desktop installer has been failing. Please keep in mind that I have already tried the following and it hasn't worked:
Ensured that Docker desktop has been completely uninstalled on my work device
Tried installing the previous docker desktop versions that were working
Unchecked the box to install the required modules for wsl (tried it with and without)
Here is the error I receive:
Component CommunityInstaller.ExecAction failed: Process InstallerCli.exe exited with code 1
at CommunityInstaller.InstallWorkflow.d__30.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 CommunityInstaller.InstallWorkflow.d__24.MoveNext()
Any suggestions on why this is happening and how to resolve it?
Thanks in advance.
Deleted the folders:
C:\ProgramData\Docker (if you cant, rename the folder)
C:\Program Files\Docker
After this, docker 4.6.0 was installed successfully.
I am trying to install Docker Desktop on Windows 10 Pro 21H1, but I'm constantly getting the below error:
Component CommunityInstaller.EnableFeaturesAction failed: Not found
at CommunityInstaller.InstallWorkflow.<DoHandleD4WPackageAsync>d__29.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 CommunityInstaller.InstallWorkflow.<DoProcessAsync>d__23.MoveNext()
I have tried deleting:
C:\Program Files\
C:\Users\username\AppData\Local\Docker
C:\Users\username\AppData\Local\Docker Desktop
... and other Docker related folders multiple times.
I have WSL2 running fine on my system with Ubuntu 20.
sid_c06#LAPTOP-HJCDC6N0:~$ wsl.exe -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2
I tried unchecking the WSL2 option during installation but then the step of starting Linux Containers on WSL2 fails when trying to start Docker Desktop after installation.
Unable to start
at Docker.Core.Pipe.NamedPipeClient.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 executeAfterStartCleanup)
at Docker.Actions.<>c__DisplayClass27_0.b__0()
at Docker.ApiServices.TaskQueuing.TaskQueue.<>c__DisplayClass17_0.<.ctor>b__1()
Can you let me know what am I doing wrong? Also should I go with installing Docker directly on Ubuntu on WSL2 and skip Docker Desktop? I couldn't find concreate steps for same. Let me know if that is a good idea.
I performed many actions to solve it which are listed below. I believe that resetting the WMI was the key action, though.
I deleted all remaining Docker/Docker Desktop folders in Windows:
~/AppData/Local/Docker
~/AppData/Roaming/Docker
C:\ProgramData\Docker
C:\Program Files\Docker
I also uninstalled and installed back the following windows features:
Hyper-V
Windows Subsystem Linux
Windows Hypervision Platform.
Disabled Windows Service Power
Reset the WMI
Disable and stop the WMI service:
sc config winmgmt start= disabled
net stop winmgmt
Run the following commands:
Winmgmt /salvagerepository %windir%\System32\wbem
Winmgmt /resetrepository %windir%\System32\wbem
Re-enable the WMI service and reboot:
sc config winmgmt start= auto
(note that there is a blank between '=' and 'auto')
If the problem remains, then try the following steps to rebuild the repository:
Disable and stop the WMI service
sc config winmgmt start= disabled
net stop winmgmt
(note that there is a blank between '=' and 'disabled')
Rename the repository folder (located at %windir%\System32\wbem\repository) to repository.old
Re-enable the WMI service
sc config winmgmt start= auto
Reboot the machine.
Reference this SuperUser answer
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.
The main goal to fix this is:
Press windows "start" button
Enter by keyboard services + enter
Find two of them : "Hyper-V Virtual Machine Management" and "Hyper-V Host Computer Service"
(on each service)click mouse right-button, select "properties" and change in opened window "startup type" to "manual", then "ok" button.
Click again on each mouse right-button and select start
Press windows "start" button, enter "hyper-v", it will show you hyper manager, open it
In hyper-v manager select "connect to server", from pop-up select "local computer"
Run your desktop docker it is probably working now with no crashes and exceptions.
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.
Click on the Start button
Then type services
Search for Docker Desktop Services.
Click on that
On the top left click on stop service
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
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:
Reboot your computer.
Press DEL or F2 or whatever it is for your computer to get into the BIOS.
Look for CPU settings, then find something called VT-x, AMD-V, SVM, or Vanderpool. Enable it.
Save settings and restart your computer.
You should be open Hyper-V section.Docker doesn't work without Hyper-V.
How to open Hyper-V section:
Right click on the Windows button and select 'Apps and Features'.
Select Programs and Features on the right under related settings.
Select Turn Windows Features on or off. Select Hyper-V and click OK.
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...
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.
Updating my Windows version seems to fix this problem. I had the same error, but after updating Windows, Docker is working like a charm.
I continue to get the following error when trying to start docker on Windows 10 pro. my HyperV is turned on and running:
Version 18.04.0-ce-win62 (17151)
Channel: edge
e0a85f6
Any help would be appreciated!
Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Hyper-V encountered an error trying to access an object on computer 'C001715587' because the object was not found. The object might have been deleted. Verify that the Virtual Machine Management service on the computer is running.
at New-Switch, : line 117
at , : line 394
at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeClient.cs:line 36
at Docker.Actions.DoStart(SynchronizationContext syncCtx, Boolean showWelcomeWindow, Boolean executeAfterStartCleanup) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 75
at Docker.Actions.<>c__DisplayClass15_0.b__0() in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 59
at Docker.WPF.TaskQueue.<>c__DisplayClass19_0.<.ctor>b__1() in C:\gopath\src\github.com\docker\pinata\win\src\Docker.WPF\TaskQueue.cs:line 59
You may need to fix your "Control Flow Guard" settings for vmcompute.
(Be aware that CFG is an exploit-protection mechanism, so pay attention when changing it and understand why it exists.)
Open Windows Security
Open App & Browser control
Click Exploit protection settings
Switch to Program settings tab
Locate C:\WINDOWS\System32\vmcompute.exe in the list and expand it
Click Edit
Scroll down to Control flow guard (CFG) and uncheck Override system settings
Start vmcompute from powershell net start vmcompute (or alternately start the Hyper-V Host Compute Service from the system Services app)
Restart PC
Open Hyper-V as Administrator
Connect to Server, Local computer, OK
The above worked for me when I couldn't run docker, then I realized I couldn't connect to my local machine on hyper-v. This is what finally worked.
Try this. It's sorting the problem of many people.
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
I tried to run it from C:\Program Files\Docker\Docker\Docker Desktop.exe
And it worked.
Also, one more thing I added is I kept the Cisco AnyConnect VPN service running (although none of the VPNs were connected). I know this point sounds weird but I thought to share it.
If You, like me, already have an installed wsl2 distro on Your system (at the time You install Docker Desktop) and all the answers above did not help, than look if Your distro is actually running by hitting the command wsl -l -v
wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2
docker-desktop Running 2
docker-desktop-data Running 2
If so, then shutdown Your wsl instance by running wsl -t Ubuntu-20.04 this fixed the issue on my system. Docker Desktop window came immediately up after the wsl instance was down.
I think the problem is that I already have a docker installed in this wsl instance.
If you facing
Unable to stop Hyper-V VM: Service 'Hyper-V Host Compute Service
(vmcompute)' cannot be started due to the following error: Cannot
start service vmcompute on computer '.'.
this error then follow the steps:
Open "Window Security"
Open "App & Browser control"
Click "Exploit protection settings" at the bottom
Switch to "Program settings" tab
Locate "C:\WINDOWS\System32\vmcompute.exe" in the list and expand it
Click "Edit"
Scroll down to "Code flow guard (CFG)" and uncheck "Override system settings"
Start vmcompute from powershell "net start vmcompute"
The fix for me was to enable virtualisation in my bios. It'll be in Advanced > CPU Configuration > SVM - make sure it's enabled