I am trying to automate the installation of Docker Desktop and some Linux containers on Windows 11 Enterprise but am unable to default Docker to use WSL 2.
According to the Docker Desktop Installer documentation the --backend=wsl-2 parameter should setup Docker to run using WSL2. But when I launch “Docker Desktop.exe” for the first time it shows the error: “Required Windows features(s) not enabled: Hyper-V. Switch to WSL 2 base engine?” This stops automation and requires manual entry before installing the Linux containers.
A log file entry in c:\program data\Docker Desktop\install-log-admin.1.txt appears to know that WSL 2 is desired as it has this entry:
Selected backend mode: wsl-2
The Powershell script I am using to run the installer is the following:
Start-Process -Wait -NoNewWindow -FilePath "Docker Desktop Installer.exe" -ArgumentList "install --backend=wsl-2 --quiet --accept-license " -ErrorAction Stop;
But if I launch the installer manually/interactively and keep the default options then Docker Desktop is setup to use WSL 2 and doesn’t display this error.
Is there a workaround?
Note: Docker Desktop Version: 4.8.2
Things I’ve tried that have failed:
- Using command-line instead of PowerShell