Technical Anshu
Tutorials Blog
🐳 Docker Basics

Why Docker on Windows Needs WSL 2 and a Real Linux Kernel

A container is not a small virtual machine - it is a Linux process that borrows the host's Linux kernel. Windows does not have one. WSL 2 quietly supplies a real Linux kernel in a lightweight utility VM, and that single fact is the whole reason Docker on Windows works the way it does.

✍️ Technical Anshu🪟 Windows 10 / 11⏱️ 6 minute read
🎥 Watch the full install in the video - WSL 2 setup and the first container, step by step

People ask why Docker Desktop insists on WSL 2 when WSL 1 already 'runs Linux'. The short answer: WSL 1 translated Linux calls into Windows calls, and a translation layer is not a kernel. Docker's engine needs real kernel features - namespaces, cgroups, overlay filesystems. WSL 2 runs an actual Microsoft-maintained Linux kernel, so the engine runs natively. Here is the honest picture, including the small performance tax you pay for it.

WSL 1 vs WSL 2 - the difference that decides Docker
Linux kernelWSL 1 translated  |  WSL 2 real kernel
Docker engineWSL 1 cannot host it  |  WSL 2 runs it natively
File speed on Linux filesWSL 1 good  |  WSL 2 excellent
File speed on /mnt/c Windows filesWSL 1 faster  |  WSL 2 slower
Memory styleWSL 1 tiny  |  WSL 2 dynamic VM, grows
The honest trade in one panel - WSL 2 wins on compatibility and Linux-side speed, and pays for it in memory and cross-filesystem speed
1

What a Container Actually Needs from the Kernel

A container shares the host kernel. The isolation, resource limits and layered filesystem that make Docker work are Linux kernel features. That is why every Linux container on any platform is, underneath, talking to a Linux kernel somewhere.

  1. On a Linux PC, containers use the PC's own kernel directly
  2. On Windows, there must be a Linux kernel somewhere - Docker Desktop puts one inside the WSL 2 utility VM
  3. Windows containers exist as a separate technology, but the Docker world of images you will pull is overwhelmingly Linux containers
2

Why WSL 1 Was Not Enough

WSL 1 worked by translating each Linux system call into a Windows equivalent. Clever, but translation has gaps: some kernel behaviour simply has no Windows twin, and Docker's engine hit those gaps immediately.

WSL 2 changed the architecture completely: a real Linux kernel running in a very light virtual machine managed by Windows. Startup is fast, memory is given back when idle (mostly), and because the kernel is real, Linux software - including the Docker engine - behaves exactly as it does on a Linux PC.

3

Where the Docker Engine Actually Lives

When you install Docker Desktop with the WSL 2 backend, the engine (dockerd) runs inside a special hidden WSL distribution managed by Docker itself. Your own Ubuntu distro then gets the docker command connected to that engine if you enable WSL Integration in Docker Desktop settings.

  1. Windows terminal runs the client
  2. The client talks to the engine inside the WSL 2 VM
  3. Containers run in that same Linux environment, next to the engine

This is also why docker ps from inside Ubuntu and from PowerShell show the same containers - there is only one engine.

4

The Honest Costs

Memory: the WSL 2 VM grows as containers need RAM and does not always shrink back immediately. You can cap it with the .wslconfig file - there is a page in this set on exactly that.

Cross-filesystem speed: containers reading files from /mnt/c (your Windows drives) are much slower than reading files stored inside the Linux filesystem. Keep the project inside Ubuntu for real work.

One more kernel to update: wsl --update keeps the kernel current, and an out-of-date kernel is a common cause of Docker start failures.

🎥 Watch the Complete Process in the Video

Watch the video to see WSL 2 and Docker Desktop set up together, in the right order, from a clean machine.

▶️ Watch Full Video
❓ Frequently Asked Questions

Can Docker Desktop use Hyper-V instead of WSL 2?

On Windows Pro and Enterprise there is an older Hyper-V backend, but WSL 2 is the recommended backend for almost everyone - it starts faster, uses resources dynamically and works on Home editions too. This set covers the WSL 2 route only.

Is WSL 2 a full virtual machine like VirtualBox?

It is a lightweight utility VM running a real Linux kernel, managed automatically by Windows. You do not create, snapshot or maintain it like a normal VM - you just use the distros inside it.

Why is my container slow when the project is on the C drive?

Files reached through /mnt/c cross the Windows-Linux boundary on every operation, which is slow for the thousands of small files in a typical project. Move the project into the WSL filesystem (for example your Ubuntu home folder) and the same container becomes much faster.

This guide is based on the Technical Anshu Docker on WSL 2 video • Stuck on any step? Ask in the video comments — you will get a reply there 🙏