Force docker for Windows to use Hyper-V instead of WSL2

Viewed 4257

Since version 2.3.0.2 docker desktop is able to be installed on Windows 10 Home edition, because it can use windows feature WSL2 instead of Hyper-V. Windows 10 Home edition does not come with Hyper-V installed.

I am restricted to Windows 10 Home edition and the project I'm working on does not function with WSL2 as the docker-for-windows backend; only with Hyper-V. I installed Hyper-V on Windows 10 Home using the batch script below, but am unable to switch from WSL to Hyper-V in docker.

The option is greyed out.

The option is greyed out.

How do I force docker to use Hyper-V instead of WSL2 on Windows 10 Home?

Batch script to install Hyper-V on Windows Home:

pushd "%~dp0"dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt

for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"

del hyper-v.txt

Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
1 Answers

This is likely due to a docker software update, docker will automatically use WSL even if the previous Docker version was initially enabled for Hyper-V.

To fix this:
Uninstall and re-install docker and follow procedure for Hyper-V usage.

Related