tdragojevic
tdragojevic

Reputation: 445

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

Upvotes: 10

Views: 11769

Answers (3)

Wilson Wu
Wilson Wu

Reputation: 2053

  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.

Upvotes: 1

Aoba K
Aoba K

Reputation: 101

To install Docker for Windows using Hyper-V in Home Edition, registry hack is needed to pretend system as Pro Edition.

REG ADD "HKEY_LOCAL_MACHINE\software\Microsoft\Windows NT\CurrentVersion" /v EditionId /T REG_EXPAND_SZ /d Professional /F

(from some Chinese forums without source of it)

This would overwrite the origin value of the EditionId key, though it does little to the activation license. If you change the value back, the checkbox would turn to grey which OP mentions. However it will still using the Hyper-V backend. (You can check it by entering Hyper-V Console and open DockerDesktopVM to see if it's working)

To re-enable the checkbox if you want to checkout WSL2, quit Docker Desktop via tray icon, set the hack and start Docker Desktop.

Tested on Windows 11 22H2 Home Edition


Similar questions:

Docker for windows 10 home edition

Can't install Docker : Docker Desktop requires Windows 10 Pro or Enterprise version 15063 to run

(This question here)

Docker installation on Windows 10 Home

Upvotes: 2

aiSolutions
aiSolutions

Reputation: 220

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.

Upvotes: -1

Related Questions