Docker Desktop for Windows on WSL2 - Part 0.1

Posted on September 07, 2020 in DevOps
Updated: November 09, 2020

This blog is part of a serie:

In this blog I just wanted Docker on my Windows 10 Home box.
I ended up with upgrading Windows allowing me to install Docker Desktop running on WSL2.
This is the path I took to get there and some additional experiments I had with WSL2.

Getting Docker up working

Something nice-to-know

I have run docker some times before, where it was running on Hyper-V on a Windows 10 Pro. I thought I was going to perhaps run on Hyper-V or VirtualBox.


  • Docker needs a hypervisor, which on Windows can either be hyper-v, VirtualBox and now also Virtual Machine Platform.
  • Docker Desktop For Windows (DD4W) superseeds Docker CE For Windows (DCE4W)
  • Presumingly DD4W runs on top of WSL2, so it is only on Windows 10 from May 2020
  • DCE4W:

Install Docker

In the beginning I didn't want to upgrade Windows - I thought I could make it work without upgrade.
Here is how it went on:

To check if you have Docker. Start by typing

docker -v

to see if you already have docker installed.

I Downloaded latest DD4W. I tried to use v.

I had several issues and possible solutions:

  • Tried to install v. gave me this error:
    • Error: Docker Desktop requires Windows 10 Pro/Enterprise (15063+) or Windows 10 Home (19018+).
    • Mine was only Home os 18362 / v1909 (see System Information)
  • Yet a failed try: Download DD4W v.
    • Error: Docker Desktop requires Windows 10 Pro or Enterprise version 15063 to run.
  • Yet a failed try: Download DCE4W v.
    • Error: Docker for Windows requires Windows 10 Pro or Enterprise version 14393 to run.
  • Yet a failed try: Download DCE4W v.
    • Error: Docker for Windows requires Windows 10 Pro or Enterprise version 10586, or Windows server 2016 RTM to run
  • Yet a failed try: Download DCE4W v.
    • Error: Unable to stop: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The specified module 'Hyper-V' was not loaded because no valid module file was found in any module directory.
    • OK, Hyper-V needs to be activated - Activate the windows hypervisor platform feature.
      Activate win hypervisor
    • Boot the PC
    • Uninstall DCE4W
    • Re-install DCE4w
    • Start DCE4w
    • Error - same as above - yak!
    • Deactivate windows hypervisor platform
    • Please uninstall DCE4W again.
    • Boot PC
    • Apparently win Hypervisor does not cover for hyper-v from this old Docker version!
  • Yet a failed try: Trying to install hyper-v on win 10 home:
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

# Deployment Image Servicing and Management tool
# Version: 10.0.18362.900

# Image Version: 10.0.18362.1016

# Error: 0x800f080c

# Feature name Microsoft-Hyper-V is unknown.
# A Windows feature name was not recognized.
# Use the /Get-Features option to find the name of the feature in the image and try the command again.

# The DISM log file can be found at C:\windows\Logs\DISM\dism.log

I could not install Hyper-V on the Windows 10 Home! It requires Pro or more.
So I could choose between running on VirtualBox or update Windows so I could run on WSL2.
I thought that now I had already wasted much time, then I could just as well go for the trouble and install WSL2:

Install WSL2:

  • Download Windows 10 may 2020 update (v 2004)
    • Click Update Now - this takes a loooong time.
    • Boot the PC
    • Now running os 10.0.19041.423 v2004
    • OK, another Hypervisor needs to be activated - Activate the Virtual Machine Platform feature. Activate Virtual Machine Platform
    • Boot the PC

Next install Docker Desktop:

  • Download DD4W v.
    • Choose to enable WSL2
      Enable WSL2
    • Boot the PC
    • WSL2 is now enabled
      WSL2 enabled
    • Now you are told to Update the WSL2 Linux kernel
      Update Linux kernel
    • From the link you enter a web, where you can download the X64 update. When you execute it, you see
      WSL2 Update wiz
    • Now press Restart - This restarts DD4W - and now it will come up in state runnning. You can see it in the taskbar. DD4W running
    • There is a new virtual network adapter (WSL). Before - with Hyper-V there were two: Default switch and DockerNAT
      WSL virtual network adapter
# Check that Docker is installed
docker -v
# Docker version 19.03.12, build 48a66213fe

# Check WSL modes (1 or 2):
wsl -l -v
#   NAME                   STATE           VERSION
# * docker-desktop         Running         2
#   docker-desktop-data    Running         2

Some extra tips:

  • Visual Studio Code recommends to install Remote - WSL extension
    VSCode WSL extension
  • This enables you to start a terminal into the Linux machines running in WSL2
    Connect to WSL2 machines
  • In DD4W settings you see that with Win Home you can only run in WSL2 (opposed to Hyper-V or VirtualBox). We know that - we had to update Win 10 to v2004 in order to install DD4W!
    DD4W settings

Great - Docker is running on WSL2 now.

Using Docker

I'll follow up on using Docker in another blog. Here I'll just remind you that you need somewhere to get Docker images from.

Connect to an Image Registry - DockerHub

When using Docker you need an image registry to read base images from and to save your images to. I'll just use the public and free Docker hub.
If you don't have an account then create one.

SignIn to DockerHub

Using WSL2

WSL not only gives Linux distros hosting Docker.
It also gives you possibility to host other Linux distros - for instance if you want to develop inside a Linix disto running in WSL on Windows.

Develop remote in WSL2 with Docker

A development strategy - here just an experiment.

If you have the need of developing in Linux then you can use WSL as your DevBox - cool, if you need that.
I had an idea of developing in the Linux CentOS distro, since it is where the community edition of OpenShift is installed by default (or that is something like that I think it is).
Here is where that brought me:

By using workflow Develop with Docker and WSL2 then you work with VSCode in your default Linux distro running in WSL2.
Using VSCode extention Remote - WSL then you can get a remote CLI into your linux distro by typing wsl (and exit to get back locally).
From the remote CLI you startup vscode just as when you work locally: code .

Choosing and installing a Linux Distro

But you might be missing a WSL2 distro - I did: Missing WSL2 distro
There is a small selection of distros.

  • Most of all I wanted a CenOS distro, since I want to have OpenShift in it and CentOS is the RedHat community version coming with OpenShift.
  • There is Pengwin Enterprise based on CentOS, but what - now Microsoft wants me to pay for Linúx???
    And also Biz users are required to get a Red Hat Enterprise Linux subscription, when using it.
  • I'll go for 2nd best which is another RPM based distro.
  • I can choose between Fedora and OpenSuse. Also Fedora Remix for WSL is not free....
  • So remaining is openSUSE-Leap-15-1, which still is free.
  • Also there are two SUSE Enterprise for free.

A little sidestep to OpenShift

As an alternative to have CentOS there are

And perhaps this could be of interest

Install a WSL distro

Installing WSL2 distro
Note: You have to give this WSL PC a default username and psw - just like your Windows box.

wsl -l -v
#   NAME                   STATE           VERSION
# * docker-desktop         Running         2      
#   docker-desktop-data    Running         2      
#   openSUSE-Leap-15-1     Running         1

Hmm - Suse is not running wsl2 and is not default

# future WSLs will be v2
wsl --set-default-version 2

# set suse v2
wsl --set-version openSUSE-Leap-15-1 2
# Conversion in progress, this may take a few minutes...
# For information on key differences with WSL 2 please visit
# Conversion complete.

# so what is status now?
wsl -l -v
#   NAME                   STATE           VERSION
#   openSUSE-Leap-15-1     Stopped         2

# Please help
wsl -h
# Usage: wsl.exe [Argument] [Options...] [CommandLine]
# Options:
#     --distribution, -d <Distro>
#         Run the specified distribution.

# Arguments for managing Windows Subsystem for Linux:
#     --set-default, -s <Distro>
#         Sets the distribution as the default.

# set suse default and start it
wsl --set-default openSUSE-Leap-15-1

# so what is status now?
wsl -l -v
#   NAME                   STATE           VERSION
# * openSUSE-Leap-15-1     Running         2

# Now you can enter your default SUSE wsl just by typing

Note about sharing folders

Notice the local folder in Windows is mounted inside the Linux distro,
so you are able to work from Linux on your files in your Windows drive.

rasorwin@MYPC> # Now in Windows
rasorwin@MYPC❯ wsl # Enter SUSE 
rasorsuse@MYPC:/mnt/c/Users/rasorwin> cd .. # Notice current dir is in windows
rasorsuse@MYPC:/mnt/c/Users> ls
All Users  Default  Default User  desktop.ini  Public  rasorwin
rasorsuse@MYPC:/mnt/c/Users> exit # Go back into windows

Best practice for sharing folders are not sharing windows into linux, but instead sharing linux out to windows

Docker integration

Going back in docker - Press Refresh - then you will also see your OpenSuse installed
WSL2 distro installed
you don't have to enable integration there, since you have set it default and you have enabled integration to default distro.

USeful Links

The End