dockerdocker-for-windowsdocker-desktop

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


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

Solution

    1. Go to Docker Desktop: Settings -> General
    2. You can find 'Use the WSL 2 based engine' check box, uncheck it
    3. Install Hyper-V and restart your computer
    4. Launch Docker Desktop, all done.