How to fix Docker Desktop - Unexpected WSL error in Docker
This error occurs when Docker Desktop fails to communicate with the Windows Subsystem for Linux (WSL 2) backend. It typically appears on Windows 10/11 when WSL components are misconfigured, outdated, or conflicting with other software like VPNs or Hyper-V settings.
Quick fix
Fixes Docker Desktop - Unexpected WSL error
wsl --shutdown- Restart WSL and Docker Desktop
- Update WSL to the latest version
- Enable required Windows features
- Ensure the Hyper-V hypervisor is enabled
wsl --shutdownDocker Desktop - Unexpected WSL error
What this error means
Docker Desktop on Windows uses WSL 2 (Windows Subsystem for Linux) as its default backend for running Linux containers. When Docker starts, it creates two WSL distributions: 'docker-desktop' and 'docker-desktop-data'. The 'Unexpected WSL error' message indicates that Docker cannot properly initialize or communicate with these WSL distributions. This can happen for several reasons: the required Windows features (Virtual Machine Platform, WSL) might not be enabled, the Hyper-V hypervisor might be disabled, the WSL kernel might be outdated, or there could be conflicts with VPN software or other virtualization tools. In some cases, the Docker WSL distributions themselves become corrupted and need to be re-registered.
Typical symptoms
- Docker Desktop shows 'Unexpected WSL error' dialog on startup
- Error message mentions 'An unexpected error was encountered while executing a WSL command'
- Docker Desktop fails to start or gets stuck at 'Starting...'
- WSL distributions 'docker-desktop' or 'docker-desktop-data' are missing when running 'wsl -l -v'
- Error codes like 0x80070422, 0x8037011e, or 4294967295 appear
- Docker worked before a Windows update or system restart
Common causes
- Virtual Machine Platform Windows feature is not enabled
- Hyper-V hypervisor is disabled in boot configuration
- WSL 2 kernel is outdated and needs updating
- VPN software (like NordVPN) is interfering with WSL networking
- Docker Desktop WSL distributions are corrupted or missing
- Virtualization is disabled in BIOS/UEFI settings
- Recent Windows update broke WSL compatibility
- Docker was installed to a custom location causing path issues
- Host Compute Service is stopped or malfunctioning
How to fix "Docker Desktop - Unexpected WSL error"
Start with the simplest fix. Open PowerShell or Command Prompt as Administrator and run:
wsl --shutdownWait a few seconds, then restart Docker Desktop. This terminates all WSL instances and often resolves temporary issues.
An outdated WSL kernel is a common cause. Run these commands as Administrator:
wsl --updateIf that fails, download the manual installer from https://aka.ms/wsl2kernel and run the wsl_update_x64.msi file.
Docker Desktop requires Virtual Machine Platform and WSL. Open PowerShell as Administrator:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartRestart your computer after enabling these features.
Check if the hypervisor is enabled:
bcdedit /enum | findstr -i hypervisorlaunchtypeIf you see hypervisorlaunchtype Off, enable it with:
bcdedit /set hypervisorlaunchtype AutoRestart your computer for changes to take effect.
VPN software, especially NordVPN, can interfere with WSL networking. Try:
1. Disconnect from VPN (keep the app running, just disconnect)
2. Restart Docker Desktop
3. If Docker works, you may need to configure split tunneling or disable VPN while using Docker
Network configuration issues can prevent WSL from working. Run as Administrator:
netsh winsock resetRestart your computer after running this command.
If the Docker WSL distributions are corrupted, remove them so Docker can recreate them:
wsl --unregister docker-desktop
wsl --unregister docker-desktop-dataWarning: This will delete all Docker containers and images. Back up important data first using docker save and docker export.
After unregistering, restart Docker Desktop. It will recreate the distributions automatically.
A corrupted settings file can prevent Docker from starting. Close Docker Desktop completely, then delete:
%AppData%\Docker\settings.jsonDocker will recreate this file with default settings on next start. Your containers and images are preserved.
If nothing else works:
1. Uninstall Docker Desktop from Windows Settings > Apps
2. Run wsl --unregister docker-desktop and wsl --unregister docker-desktop-data
3. Restart your computer
4. Download the latest Docker Desktop from https://www.docker.com/products/docker-desktop
5. Install using the default settings (do not use custom install location)
Advanced notes
VM Time Sync Issues: If Docker containers show incorrect time, run sudo hwclock -s inside WSL to sync the VM clock with the host.
Azure/AWS VMs: If running Docker Desktop in a cloud VM, you need nested virtualization support. This is only available on specific VM sizes (Dv3, Ev3 series on Azure) and regions.
Windows Insider/Preview builds: Newer Windows builds may break WSL compatibility temporarily. Check Docker's GitHub issues for known compatibility problems.
Alternative: If WSL 2 continues to cause issues, you can switch Docker Desktop to use the Hyper-V backend instead. Edit %AppData%\Docker\settings.json and set wslEngineEnabled to false. Note that Hyper-V backend has different performance characteristics and requires Hyper-V feature enabled.
Frequently asked questions
- What does "Docker Desktop - Unexpected WSL error" mean?
- Docker Desktop on Windows uses WSL 2 (Windows Subsystem for Linux) as its default backend for running Linux containers. When Docker starts, it creates two WSL distributions: 'docker-desktop' and 'docker-desktop-data'. The 'Unexpected WSL error' message indicates that Docker cannot properly initialize or communicate with these WSL distributions.
- How do I fix "Docker Desktop - Unexpected WSL error"?
- This error occurs when Docker Desktop fails to communicate with the Windows Subsystem for Linux (WSL 2) backend. It typically appears on Windows 10/11 when WSL components are misconfigured, outdated, or conflicting with other software like VPNs or Hyper-V settings.
- What causes "Docker Desktop - Unexpected WSL error"?
- Virtual Machine Platform Windows feature is not enabled Hyper-V hypervisor is disabled in boot configuration WSL 2 kernel is outdated and needs updating
- Is the "Docker Desktop - Unexpected WSL error" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐Docker Official Documentation
- ๐
- ๐
- ๐ฌDocker Community Forums - WSL command error(Stack Overflow)
- ๐ฌStack Overflow - WSL command error fix(Stack Overflow)
- ๐Microsoft Docs - Docker containers on WSL(Official Docs)