Windows Subsystem for Linux version 2 (WSL2) is a feature that lets Windows run Linux distributions directly, without needing a separate virtual machine. WSL2 uses a real Linux kernel, which makes it much faster than the original WSL and gives it the ability to run Linux containers effectively. This matters because many modern applications and DevOps tools are built for Linux, and WSL2 lets Windows servers support those workloads. The key advantage is that you get Linux compatibility while staying on Windows, which simplifies management in hybrid environments.
To use WSL2 for containers, you first must enable the Windows Subsystem for Linux feature on your Windows Server or Windows 11 machine. You can do this through the Windows Features dialog or by running a simple PowerShell command. After enabling the feature, you install a Linux distribution from the Microsoft Store, such as Ubuntu or Debian. Once installed, you upgrade that distribution from WSL1 to WSL2 using the wsl --set-version command, because WSL2 provides the full kernel support needed for running containers. Without this upgrade, Linux containers will not work properly.
With WSL2 running, the next step is to install a container runtime that can actually manage Linux containers. Two common options are Docker and containerd. Docker Desktop can be installed on Windows and configured to integrate with WSL2 during setup, which makes Linux containers appear as if they are running natively. When Docker or containerd runs inside WSL2, it shares the WSL2 kernel rather than creating its own virtual machine, which keeps resource usage lower. This integration is what allows you to run docker pull, docker run, and other container commands from a Windows terminal while the containers actually execute inside WSL2.
Linux containers running under WSL2 need proper resources to perform well, and you control this through a file called .wslconfig in your user folder. This file lets you set how much CPU, memory, and disk WSL2 can use, which directly affects how many containers you can run and how fast they perform. If you allocate too little memory, containers may crash or run slowly; if you allocate too much, Windows itself may not have enough resources. The goal is to balance performance, isolation from Windows, and compatibility with your container workloads. Each time you change .wslconfig, you must restart WSL2 with wsl --shutdown for the new settings to take effect.
Eager to master hybrid server management? Discover how to administer Windows Server Hybrid Core Infrastructure on Azure, setting your path towards the Microsoft Certified: Azure Hybrid Infrastructure Administrator Associate certification!
Prepare and test your skills

Prepare and test your skills

A distribution must be upgraded to WSL2 because WSL2 uses a real Linux kernel that provides the full kernel support required to run Linux containers. Without upgrading from WSL1 to WSL2, Linux containers will not work properly.
Container runtimes such as Docker and containerd integrate with WSL2 by sharing the WSL2 kernel rather than creating a separate virtual machine. This reduces resource usage and allows you to run container commands from a Windows terminal while the containers execute inside WSL2.
Resource allocation is controlled by modifying the .wslconfig file in your user folder to set limits for CPU, memory, and disk usage. Each time you update this configuration file, you must restart WSL2 using the wsl --shutdown command for the changes to take effect.