This blog is part of a serie:
- Part 0.1: Install Docker Desktop on Windows 10 Home - including WSL (this blog)
- Part 0.2: Install k8s using kind on Windows - including arkade
- Part 1.1: Run docker containers
- Part 1.2: Develop .NET docker images
- Part 1.3: Run containers in k8s
- Part 2.0: Deploy containers to Civo
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
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
- By default DCE4W will use hyper-v.
- If you wanted to use VirtualBox you could get it included with Kitematic in Docker Toolbox. You could then can use Kitematic to swap from hyper-v to ViretualBox.
- With DD4W then Docker Toolbox, Kitematic and Docker machine are superceeded products
- My older blogs on howto install DCE4W:
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
to see if you already have docker installed.
I Downloaded latest DD4W. I tried to use v.22.214.171.124
I had several issues and possible solutions:
- Tried to install v.126.96.36.199 gave me this 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.188.8.131.52
Docker Desktop requires Windows 10 Pro or Enterprise version 15063 to run.
- Yet a failed try: Download DCE4W v.184.108.40.206
Docker for Windows requires Windows 10 Pro or Enterprise version 14393 to run.
- Yet a failed try: Download DCE4W v.220.127.116.11
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.18.104.22.168
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 platformfeature.
- Boot the PC
- Uninstall DCE4W
- Re-install DCE4w
- Start DCE4w
- Error - same as above - yak!
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:
# https://answers.microsoft.com/en-us/windows/forum/all/hyper-v-is-missing/191e7c79-2c95-4417-b877-f40f6f856108 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:
- 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 Platformfeature.
- Boot the PC
Next install Docker Desktop:
- Download DD4W v.22.214.171.124
- Choose to enable WSL2
- Boot the PC
- WSL2 is now enabled
- Now you are told to Update the WSL2 Linux kernel
- From the link you enter a web, where you can download the X64 update. When you execute it, you see
- Now press
Restart- This restarts DD4W - and now it will come up in state
runnning. You can see it in the taskbar.
- There is a new
virtual network adapter (WSL). Before - with Hyper-V there were two:
- Choose to enable WSL2
# 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
- This enables you to start a terminal into the Linux machines running in WSL2
- 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!
Great - Docker is running on WSL2 now.
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.
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
exit to get back locally).
From the remote CLI you startup vscode just as when you work locally:
Choosing and installing a Linux Distro
But you might be missing a WSL2 distro - I did:
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
- Guide to Installing an OKD 4.4 Cluster on your Home Lab
- Setup Local OpenShift Origin (OKD) Cluster on CentOS 7
- Install OKD - The Community Distribution of Kubernetes that powers Red Hat OpenShift. (before: openshift.org)
- Install openSUSE Kubic container manager
- OpenShift Client Tools
- Setup OpenShift Origin (OKD) on Ubuntu 19.04/18.04/16.04
- Install OpenShift Origin on Ubuntu 18.04
And perhaps this could be of interest
- Yet another pod manager Podman Installation
- 10 Kubernetes distributions leading the container revolution
Install a WSL 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 https://aka.ms/wsl2 # 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 wsl
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 logout rasorwin@MYPC>
Best practice for sharing folders are not sharing windows into linux, but instead sharing linux out to windows
Going back in docker - Press Refresh - then you will also see your OpenSuse installed
you don't have to enable integration there, since you have set it default and you have enabled integration to default distro.
- Install Docker Desktop on Windows Home
- DD4W Frequently asked questions (FAQ)
- Deploy containers to cloud without k8s: