How I Fixed the Docker WSL2 Error on Windows

Ikegah OliverIkegah Oliver
4 min read

When I first set up Docker Desktop on my Windows 10 machine, I expected things to “just work.” I had followed the installation tutorial video on YouTube to the letter. Instead, I was met with a series of cryptic errors related to WSL2 and virtualization. This article shares how I ran into the problem, how I solved it, and what I learned about the relationship between Docker, WSL2, Ubuntu, and Windows along the way.

How I Encountered the Problem

After installing Docker Desktop, I attempted to launch it, but the Docker engine failed to start. The UI showed an error like this:

"Unexpected WSL error"

After pasting the full error message on Google, I was told to run this command to check the WSL version:

wsl --list --verbose

Which gave me:

Windows Subsystem for Linux has no installed distributions.

Instead of:

NAME                   STATE           VERSION
Ubuntu                 Running         2

I proceeded to install Ubuntu using:

wsl --install -d Ubuntu

But that led to a more alarming error:

WSL2 is not supported with your current machine configuration.
...
Error code: HCS_E_HYPERV_NOT_INSTALLED

At this point, I knew I had to look deeper into system-level configuration.

Problem Statement

Apparently, Docker Desktop relies on WSL2 to run Linux containers on Windows. However, my system:

  • Had no WSL-compatible Linux distro installed

  • Did not have virtualization enabled at the hardware level

  • Had the Virtual Machine Platform feature disabled

All of these caused WSL2 to fail, and as a result, Docker could not function.

What is WSL2?

WSL2 (Windows Subsystem for Linux version 2) is a feature in Windows 10+ that allows users to run a full Linux kernel inside a lightweight virtual machine. It enables compatibility with Linux development tools and environments directly within Windows, without needing a full dual-boot or external VM setup. Docker Desktop relies on WSL2 to provide Linux-based container functionality, making it a critical requirement for running Docker smoothly on Windows. Without WSL2 properly installed and configured, Docker cannot create or manage Linux containers.

How I fixed the Problem

Step 1: Enable Virtual Machine Platform

This Windows feature allows WSL2 to run lightweight virtual machines:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

I rebooted afterwards to apply the changes.

Step 2: Enable Virtualization in BIOS

Since I’m using an HP EliteBook ( check for your hardware manufacturer for its own setup), I followed these steps to access the BIOS settings:

  1. Restarted the laptop

  2. Clicked Esc before reboot

  3. Clicked F10 to enter BIOS Setup

  4. Navigated to System Configuration > Virtualization Technology

  5. Enabled Intel Virtualization Technology (VT-x)

  6. Saved and exited BIOS

This step was crucial. Without virtualization enabled at the hardware level, WSL2 can't create its lightweight VM.

Step 3: Install Ubuntu and Set WSL2

After reboot, I ran:

wsl --install -d Ubuntu

Then I confirmed:

wsl --list --verbose

Expected output:

NAME      STATE           VERSION
Ubuntu    Stopped         2

If Ubuntu is installed but using WSL1, you can upgrade it with:

wsl --set-version Ubuntu 2

Step 4: Configure Docker Desktop

I opened Docker Desktop and went to:

  • Settings > General → Enabled "Use the WSL 2 based engine"

  • Settings > Resources > WSL Integration → Enabled for Ubuntu

Testing That Everything Works

To confirm that Docker was functional, I ran:

docker run hello-world

Finally, Success! It displayed this message:

Hello from Docker! This message shows that your installation appears to be working correctly.

How Docker, WSL2, Ubuntu, and Windows Work Together

To make Docker work on Windows 10 with modern tooling, here’s how the components interact:

ComponentPurpose
Windows 10The host OS, which doesn’t natively run Linux
WSL2A compatibility layer that provides a real Linux kernel in a lightweight VM
Ubuntu (WSL2)The Linux distribution I installed acts as the container runtime environment
Docker DesktopInterfaces with WSL2 to manage containers, images, volumes, and networks via GUI and CLI

So when you run Docker commands on Windows, you’re actually talking to a Linux environment (Ubuntu), running inside WSL2, managed by Docker Desktop.

Conclusion

This was a great debugging journey that deepened my understanding of how Docker Desktop works on Windows. The root problem was simple in hindsight; virtualization was off, and WSL2 wasn’t properly set up.

If you run into similar issues, check:

  • That WSL2 is installed and active

  • A Linux distro (like Ubuntu) is installed and using version 2

  • Virtualization is enabled in your BIOS

  • Docker Desktop is configured to use the WSL2 backend

0
Subscribe to my newsletter

Read articles from Ikegah Oliver directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ikegah Oliver
Ikegah Oliver

I am a backend developer with a year of experience in building and maintaining scalable and performant web applications. I am proficient in a variety of technologies, including Node.js, Express.js, MongoDB, and AWS. I am also a strong problem solver and have a keen eye for detail.