Let's fix all the problems!

Upgrade from WSL 1 to WSL 2 in Windows 10 to fix Docker

This post was most recently updated on April 28th, 2022.

2 min read.

Okay – another one of the topics that I’m explaining probably more to myself than whoever’s reading this later. But that’s why I write this blog, so please bear with me. 🙂

Anyway, onto the actual issue at hand!

I was configuring Docker on WSL on my Windows laptop for development purposes. That’s supposed to be easy – install WSL, install a distribution, install Docker, switch it to using WSL, fire up your WSL command prompt and run any Docker commands there (or deploy from wherever you’re developing your stuff).

But… It doesn’t always work like that.


If you get an error like the one below:

Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?

I’m sure that this can be caused by quite a few different reasons, but in my case, the cause was clear. My distros were originally created in WSL 1 instead of 2. And hey, you might have the same issue, so read on!

You can verify this by starting your wsl and running this below to query your kernel version:

uname -r

It should show something like the below for WSL 2:

uname -r

Or by just running this in PowerShell or cmd:

wsl --list --verbose

If you get something like this:

How to query your Windows Subsystem for Linux version in command line?
How to query your Windows Subsystem for the Linux version in the command line?

You need to update to version 2. Let’s take a look at how to do that!


Well, this is actually very straightforward. You’ll need to run this in PowerShell or cmd:

wsl --set-version [distroname] 2

A sample, in line with my screenshot above, would be like this:

wsl --set-version Ubuntu-20.04 2

You need to run it for each distro you have (and want to update).

That’s it! Hope it applies to your case as well – let me know in the comments section below!


5 1 vote
Article Rating
Notify of

Inline Feedbacks
View all comments