My Docker is failing to launch on my Windows 10 Pro - docker

I have had some problems with setting up Docker on my Windows 10 pro PC. I get this crash report when I try to open it up:
Crash Report screenshot
This is the text that is inside of the box:
System.InvalidOperationException:
Failed to deploy distro docker-desktop to C:\Users\Imogen\AppData\Local\Docker\wsl\distro: exit code: -1
stdout: Access is denied.
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
I have checked my visualization settings and it is enabled. My BIOS is legacy, not sure if UEFI Firmware settings are needed for Docker. My Hyper-V is also enabled in Windows Features. I have also been accessing docker with an authorized cmd. Any advice or suggestions will be much appreciated!

This is happening because there is an incompatibility between WSL2 and Docker.
If you run wsl -l -v I'm quite sure you will see this:
As you can see the VERSION for Debian/Ubuntu/kali-linux is set to 2.
But also docker-desktop is using version 2.
My solution was to
open the Start menu and uninstall Debian/Ubuntu/kali-linux
Uninstall Docker
Go to Control Panel > Programs > Programs and Features and disable Windows Subsystem for Linux
Now reboot your machine.
Log back in, enable once again Windows Subsystem for Linux and reinstall Debian/Ubuntu/kali-linux
Now install Docker again but this time at this step untick "Install required Windows components for WSL 2"
..I know this is not a good news but this is how I fixed it.
Downgrading WSL2 to WSL1 won't help.

Docker Desktop and Docker Engine never worked for me on Windows 10, it is really unstable. Luckily, you can run Docker solely on your WSL 2 Linux Distro which gives a much more peace of mind. If interested to make docker run perfectly on Windows, install WSL 2 and choose any distro(Ubuntu for my case), then follow this article to set up Docker.

Related

How to reinstall Docker after upgrade failure?

I upgraded my Docker Desktop for Windows earlier and it failed.
So I downloaded docker installer from here and tried to reinstall it.
But it complains about
Unpacking failed: 文件“C:\Program Files\Docker\Docker\com.docker.service”正由另一进程使用,因此该进程无法访问此文件。
在 CommunityInstaller.InstallWorkflow.d__30.MoveNext()
— 引发异常的上一位置中堆栈跟踪的末尾 —
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 CommunityInstaller.InstallWorkflow.d__23.MoveNext()
What should I do?
As #kaffarell said in the comment, I closed everything Docker related in the task manager. Then I was able to reinstall docker again. All my data is preserved!

Docker Desktop installation failed (windows 10)

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.

Docker Desktop - unable to install (Windows 11)

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.

Unable to install Docker Desktop on Windows 10 Pro 21H1

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

Docker Failed to Start

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"

Resources