Windows 11 : Upgrade to WSL 2 and Docker Setup

Himanshu Upreti
3 min readJan 31, 2022

I have recently upgraded from Windows 10 to Windows 11. However, WSL 2 was introduced with Win10, I didn’t upgraded to WSL 2 then.

Anyway, now I want to and also I don’t want to remove the older distro and all work that I have done in it. Why you want to switch to WSL 2? Well, for that you can refer this cool comparison between these versions https://docs.microsoft.com/en-us/windows/wsl/compare-versions

Step 1 : Install WSL 2 / Upgrade to WSL2

If you already have WSL1 installed, the most easy step to upgrade to WSL2 would be, opening a power-shell with admin privileges run below command and you should the following result

PS C:\WINDOWS\system32> wsl --set-default-version 2

If you see the something like below, then Voilla! you already have WSL2 installed and that is now your default version.

For information on key differences with WSL 2 please visit https://aka.ms/wsl2The operation completed successfully.

Well! this may not work directly for some people (as I have faced, duh!), and you can face issues like below.

Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.

What you need to in that case, install the following features in your system.

Control Panel -> Program and Features -> Turn Windows features on or off.

Select above features for WSL 2

Reboot.

Run this again

PS C:\WINDOWS\system32> wsl --set-default-version 2

Step 1.1 : Upgrade previously installed distro

Once the WSL2 is installed / default version is set to 2, you only need to upgrade the already installed distro to version two. You list down the distro in your system.

PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Stopped 1

Then switch it up!

PS C:\WINDOWS\system32> wsl --set-version Ubuntu-20.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit
https://aka.ms/wsl2
Conversion complete.

Kudos! your distro is upgraded to WSL 2.

Step 1.2 : Do a fresh installation from Windows Store

You can also install a fresh distro from Microsoft Store, like I installed Ubuntu 18.04.

The following links will open the Microsoft store page for each distribution:

Step 2: Install Docker

In order to use docker inside your distro you need to install docker desktop application that will install docker in you system and start a daemon service which you cannot from your distro.

Download the installer from https://www.docker.com/products/docker-desktop, and follow the installation instructions to install Docker Desktop

Once the installation is done, Docker Desktop prompts you to enable WSL 2 during installation. Check that! and continue.

Now start Docker Desktop, go to Settings > Resources > WSL Integration.

Enable WSL 2 integration for your distros

Step 3 : Verify

Now, check if docker is working in every distro or not.

--

--