Problem Description:
This article solves two Docker errors:
1.WSL 2 installation is incomplete.
2.System.InvalidOperationException: Failed to set version to docker-desktop: exit code: -1
After successfully installing Docker today, I ran Docker and the following error occurred:
WSL 2 installation is incomplete.
The WSL 2 Linux kernel is now installed using a separate MSI update package.Please click the link and follow the instructions to install the kernel update:https://aka.ms/wsl2kernel.
Press Restart after installing the Linux kernel.
Cause Analysis:
Docker is a tool for packaging, distributing, and deploying applications.
Basically a lightweight virtual machine. There are only things we need in the virtual machine, other superfluous things are necessary.
Important Concepts: Image, Container
Image: Similar to software installation package, it can be quickly spread and installed.
Container: After the software is installed, each software running environment is independent and isolated, which is called a container.
Advantages: It ensures that running on different machines is a consistent operating environment, and there will be no situation where my machine runs normally and your machine runs properly.
When we install docker desktop, he asks if we need to use wsl2 (Windows based subsystem for Linux). If not, we’ll run with a Hyper-V virtual machine. However, this subsystem has better performance compared to virtual machines.
The WAL 2 Linux kernel is now installed using a separate MSI update package.
That’s the problem!
solution:
Let’s go to the system to check whether the Linux subsystem of Windows is enabled. The steps are as follows:
Control Panel -> Programs -> Programs and Features
Check if you have checked here: Enable Windows Subsystem for Linux
If not, we check it, restart the computer, and open Docker.
If you still report WSL 2 installation is incomplete. problem. There is only one reason left:
the version of wsl2 we are using is very old, so it needs to be updated manually. We can download the latest version of wsl2 from Microsoft’s official website according to the prompt, and then open it normally.
Visit the link below to download and install the update:
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
If the download is slow, use the Google browser to download, it is easy to use!
Install the latest version of wsl2:
reboot. run.
So far, most of them can run successfully. If not, there is the ultimate trick:
if you report an error at this time System.InvalidOperationException: Failed to set version to docker-desktop: exit code: -1
The error is as follows:
System.InvalidOperationException:
Failed to set version to docker-desktop: exit code: -1
stdout: �S��v�[a�{|�W
N/ec\Ջ�v�d\O0
stderr:
在 Docker.ApiServices.WSL2.WslShortLivedCommandResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode) 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\WSL2\WslCommand.cs:行号 146
在 Docker.Engines.WSL2.WSL2Provisioning.<ProvisionAsync>d__8.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Provisioning.cs:Line 82
--- The end of the stack trace in the previous location where the exception was raised ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__26.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\LinuxWSL2Engine.cs:行号 104
--- The end of the stack trace in the previous location where the exception was raised ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:行号 29
--- The end of the stack trace in the previous location where the exception was raised ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:行号 67
--- The end of the stack trace in the previous location where the exception was raised ---
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:行号 92
We open cmd as an administrator:
enter:
netsh winsock reset
Execute, 100% solve this problem!
Note: This command should be used with caution. This is to delete the original docker system, which is equivalent to resetting docker-desktop. The images and containers in me are gone. Restarting docker-desktop will regenerate docker-desktop and docker-desktop-data