Using WSL 2 on Windows Server 2022 to run Linux containers

Windows Subsystem for 2 (WSL 2) is one of the most popular features for developers on Windows 10 and 11. It has recently been made available on 2022. With this addition, you can now run containers on WSL 2 on 2022 for development and testing purposes.

Preparing your 2022

WSL 2 on Windows Server 2022 has a different requirement than Windows 10 and 11. Before you get started with WSL 2, make sure your OS is up-to-date with the latest patches. WSL 2 requires at least the June 2022 patch Tuesday release, but it's always a good practice to ensure the latest updates are installed. After that, all pre-requisites for WSL 2 to work on Windows Server 2022 can be implemented with:

wsl --install

Now you should have a fully functional environment on your Windows Server 2022 host.

Install on WSL 2 on Windows Server 2022

To install on Windows Server 2022, you need to follow the instructions for the specific distribution you chose on the previous step. Here are the instructions for Ubuntu, according to Docker's documentation page. On your Windows Server 2022, click the Start button, then click on the Ubuntu icon:


This will launch the WSL 2 console. You can now run commands on the Ubuntu Linux image as you would on a regular Linux environment. To get started, let's update the apt package index and install packages to allow apt to use a repository over HTTPS:

sudo apt-get update
 sudo apt-get install

Now, let's add 's official GPG key:

sudo mkdir -p /etc/apt/keyrings
 curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Use the following command to set up the repository:

  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg]
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install the Docker engine:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli docker-compose-plugin

Now let's verify the installation has been successfully completed:

sudo service docker start
sudo docker version

You should see the details of the Docker engine installed. That's it. You can now run the regular Docker commands you are familiar with. In addition, you can run regular Windows containers on the same host:



WSL 2 can be used on Windows Server 2022 to run Linux containers on Windows Server 2022 for development and testing purposes. Please let us know your thoughts on this scenario on the comments below.


This article was originally published by Microsoft’s System Center Blog. You can find the original article here.