Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Desktop - An unexpected error was encountered while executing a WSL command

enter image description here

I'm getting the below error after installing a new version of Docker Desktop.

An unexpected error was encountered while executing a WSL command.

Common causes include access rights issues, which occur after waking the computer or not being connected to your domain/active directory.

Please try shutting WSL down (wsl --shutdown) and/or rebooting your computer. If not sufficient, WSL may need to be reinstalled fully. As a last resort, try to uninstall/reinstall Docker Desktop. If the issue persists please collect diagnostics and submit an issue (https://docs.docker.com/desktop/troubleshoot/overview/#diagnose-from-the-terminal).

I am installing Docker Desktop in Azure Virtual Machine.

Any lead would be helpful. Thanks in advance.

like image 727
Ronak Dumaniya Avatar asked Sep 03 '25 04:09

Ronak Dumaniya


2 Answers

I got the same error and solved it by installing a Ubuntu Distribution. You need to install Ubuntu Distribution and set it as default Distribution of Windows Subsystem.

ScreenShot of how it looks after Ubuntu Distribution installed

like image 82
Larry Neil Avatar answered Sep 06 '25 02:09

Larry Neil


Here are some steps that worked for me.(Execute commands on Powershell)

I don't know if following steps solve your problem but at least it would give insight to you about problem.

Check installed distros and try to install it again.

wsl --status 

wsl -l #list wsl 

wsl –install or wsl.exe --install -d ubuntu

If you encounter with error when you are installing

Downgrade wsl version to 1 install distro and then upgrade to version 2.

wsl --set-default-version 1
wsl –install or wsl.exe --install -d ubuntu
wsl --set-default-version 2
wsl.exe --set-version ubuntu 2

Make sure that hypervisorlaunchtype auto by launching following command.

bcdedit /set hypervisorlaunchtype auto

Also make sure that all necessary(I know hyper v is not must for wsl2,nevertheless I enabled it.)

dism.exe /online /enable-feature /featurename:Microsoft-Hyper-V-All /featurename:VirtualMachinePlatform /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
like image 22
erhan355 Avatar answered Sep 06 '25 02:09

erhan355