Windows 11 : Upgrade to WSL 2 and Docker Setup

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.

--

--

--

Still reading Dragon Book and Cinderella Book

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

My Working Understanding of the Django Framework

I’m a Coder, Why Can’t I Understand Quantum Computers?

Oracle Interview Experience (On-Campus)

Continuous integration with Github Action

Why should you choose the Berkeley MEng program? Insight from faculty and staff

Go Serverless Series: Setups

Dynamic and Static libraries -What’s the difference?

Leetcode 429. N-ary Tree Level Order Traversal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Himanshu Upreti

Himanshu Upreti

Still reading Dragon Book and Cinderella Book

More from Medium

How to serve multiple web applications on a single port and different subdomains using Nginx and…

Running Redis with resilience in Linux containers on Windows — Part 4

Docker 101: Remove “sudo” need from command on Ubuntu

Sync data from linux to max