Introduction
If you’re a Windows user who wants to use Docker like a pro, then this step-by-step guide will help you set up Docker with WSL2 easily.
This modern setup ensures faster builds, full Linux compatibility, and zero hassle for Laravel, Node.js, or PHP developers.
What is WSL2 and Why It’s Needed for Docker?
WSL2 (Windows Subsystem for Linux 2) lets you run a full Linux kernel inside Windows. Docker Desktop uses WSL2 to create Linux-based containers natively on Windows without needing a virtual machine or dual-boot setup.
⚠️ Note: Docker Desktop now requires WSL2 for Linux-based containers. Without WSL2, performance will drop significantly.
Install WSL2 on Windows
Follow these steps to install and enable WSL2 properly on your Windows system.
Step 1: Enable Required Features
Search for “Turn Windows features on or off” and enable:
- ✔️ Windows Subsystem for Linux
- ✔️ Virtual Machine Platform
Step 2: Set WSL2 as Default Version
Run PowerShell as Administrator and execute:
wsl --set-default-version 2
Step 3: Update WSL2 Kernel
Download and install the WSL2 kernel update from Microsoft:
Then, run the downloaded file: wsl_update_x64.msi
Step 4: Install a Linux Distribution
Choose your preferred Linux distro (e.g., Ubuntu, Debian, etc.) and install it via PowerShell:
wsl --list --online
wsl --install -d Ubuntu
wsl --list --verbose
wsl
Install Docker Desktop
Once WSL2 is ready, it’s time to install Docker Desktop.
Visit the official Docker site and download the installer for Windows.
Step 1: Installation Options
- ✔️ Allow Windows containers → Do not check
- ✔️ Use Linux-based containers → Yes
Step 2: Complete Installation
After installation, open Docker Desktop and head to:
Settings > Resources > WSL Integration
Now check these options:
- ✅ Enable integration with my default WSL distro
- ✅ Enable integration with additional distros (if available)
Verify Docker Setup
To confirm Docker is running correctly in your WSL2 environment, open your Linux terminal (Ubuntu or your chosen distro) and run:
docker version
docker run hello-world
If you see the “Hello from Docker!” message, congratulations — your Docker setup on Windows is complete!
Docker successfully running on Windows with WSL2
Troubleshooting Tips
- If Docker fails to start, check that
Virtual Machine Platform
is enabled.
- Run
wsl --set-default-version 2
again if Linux containers show an error.
- Ensure your Linux distro is up to date:
sudo apt update && sudo apt upgrade
.
Conclusion
You’ve successfully set up Docker on Windows using WSL2 — unlocking full Linux container power inside Windows.
This setup is perfect for developers working with Laravel, Node.js, or any Docker-based projects.