On May 28th Microsoft released the long-awaited Windows 10 2004 upgrade, also known as Windows May 2020 or Windows 20H1 update. One important new feature of this upgrade is version 2 of the Windows Subsystem for Linux (WSL2). The significant change of WSL2 is that it now uses a real Linux kernel through a subset of Hyper-V features.
WSL2 is also available for Windows Home users, and here it gets interesting when you want to run Docker on Windows Home. With the new WSL2, you can now run Docker on Windows Home without installing VirtualBox. Older Windows 10 versions could already do that but only with the Pro and Enterprise edition. On Windows 10 Home you always had to run the Docker host as virtual machine inside VirtualBox. With the new Windows release this is a thing of the past and running Docker on Windows 10 Home is much easier.
In this blog post, I show you step by step how to install WSL2 and Docker on Windows Home 10 2004.
Check that you run Windows 10 2004. Open the run dialog or open a command prompt and type winver. Check that the version says 2004
If your computer runs with an older version, open the Windows Update dialog to see if the update is available. To open this dialog, run the command control update from the Run menu or command prompt.
You can force the upgrade if it's not listed on the Windows Update dialog. Download the Update Assistant from this site and run it:
The following tutorial assumes a plain Windows 10 installation without a Docker or WSL installation. I recommend deleting any previous Docker installation.
First, enable the optional features "Windows Subsystem for Linux" and "Virtual Machine Platform".
Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Reboot the computer.
Update the WSL2 Linux kernel.
and install it.
Visit this Microsoft page with more information about this update:
Open a command prompt or PowerShell and set WSL2 as default.
wsl --set-default-version 2
WSL2 is now installed. See this Microsoft page for more information about the installation process:
Usually, together with WSL2, you install a Linux distribution. This is not necessary when you only want to run Docker. Docker Desktop will install the distributions it needs during installation.
Download Docker Desktop and install it.
You find the link under the Download section on this page:
You might see a note that says Docker Desktop requires Windows Pro or Enterprise. However, it definitely works on Windows 10 Home 2004. I have tested this on two Windows 10 Home machines.
When you install Docker Desktop, make sure that the checkbox "Enable WSL 2 Windows Features" is enabled. After the installation, you need to logout from Windows and sign in again.
Docker should now run, and you can test the installation. Open a command prompt and run the hello-world container.
docker run hello-world
When you see the "Hello from Docker!" message, everything is set up correctly.
In the Settings dialog, you can customize Docker Desktop. To open the GUI of Docker Desktop, where you find the settings dialog, click on the whale icon in the icon bar and select the menu Settings.
By default, Docker starts when you log in. You can disable this behavior under Settings -> General. Uncheck the "Start Docker Desktop when you log in" option.
Volume mapping works as expected. For this example, I create
index.html in the folder
e:/temp/html and then run the
nginx Docker image.
docker run -v e:/temp/html:/usr/share/nginx/html:ro -p 8080:80 nginx
This command maps the folder
e:/temp/html from the host computer to the
/usr/share/nginx/html folder inside the container, and the host port 8080 to the container port 80. When you open a browser on http://localhost:8080 you should see the content of the index.html page. When you change the HTML file and refresh the browser, you should see the change.
This step is optional. As mentioned before, a Linux distribution is not required if you only want to run Docker. But if you want to take full advantage of WSL2 and use Linux for development, you have to install a distribution.
Open the Microsoft Store app and search for "wsl". You see a list of available Linux distributions. For this tutorial I download the Ubuntu 18.04 LTS distribution. On this page you also find a list of all available Linux distributions.
After the store app downloaded the distribution, click on Launch. This installs the distribution and in case of Ubuntu asks for a new Linux user and password.
Optionally, you can sideload the Linux distribution if you don't want to use the Microsoft Store. You find the instructions and download links on this page: https://learn.microsoft.com/en-us/windows/wsl/install-manual
Download the appx file and install it with the following PowerShell command:
To connect to Linux, open a command prompt or PowerShell and run the wsl or bash command. exit closes the Linux shell and returns to the Windows prompt.
When you install the Linux distribution after the Docker Desktop installation, the newly installed distribution is not the default and the wsl command connects to the distribution that Docker Desktop installed.
To change the default, open a command prompt and run the command
wsconfig /l to list all installed distributions. Then set the default with
wslconfig /s <distribution_name>. In my case, I run the command
wslconfig /s Ubuntu-18.04. When you run wsl or bash now, you see the prompt of the installed Linux distribution.
Note that you also have access to the
docker command from inside the Linux distribution. You don't have to install a Docker package specific for your distribution.
That concludes this tutorial about installing Docker on Windows 10 Home 2004. Thanks to the new WSL2, the setup is more streamlined and no longer requires VirtualBox.
For more information about Docker and WSL2 check out this site: