- Kubernetes DaemonSets - Wed, Sep 6 2023
- Static Pods in Kubernetes - Fri, Sep 1 2023
- Encrypt Kubernetes Secrets at rest - Mon, Aug 28 2023
Prerequisites
You might already be aware that Docker relies on virtualization technology. On Windows, Docker can use either the Windows Subsystem for Linux (WSL) 2 or Hyper-V as a backend.
Docker with WSL2 backend
The current version of Docker Desktop only works on the 64-bit edition of Windows, whether you're running Windows 10 or Windows 11. To run Docker with the WSL2 backend, your system must meet the following prerequisites:
- Windows 10: Home/Pro 21H1 (build 19043) or higher, or Enterprise/Education 20H2 (build 19042) or higher
- Windows 11: Home/Pro version 21H2 or higher, or Enterprise/Education version 21H2 or higher
- WSL2 feature enabled
- Linux kernel update package for WSL2
- For WSL2, the following are the hardware requirements:
- 64-bit CPU with second-level address translation (SLAT)
- Hardware virtualization support, which must be enabled in BIOS/UEFI
- 4 GB RAM
Docker with Hyper-V backend
To be able to run Docker with a Hyper-V backend and Windows containers, your system must meet the following prerequisites:
- Windows 10: Pro 21H1 (build 19043) or higher, or Enterprise/Education 20H2 (build 19042) or higher
- Windows 11: Pro/Enterprise/Education version 21H2 or higher
- Optional Windows features for Hyper-V and Containers must be enabled
For Hyper-V, following are the hardware requirements:
- 64-bit CPU with second-level address translation (SLAT)
- Hardware virtualization support, which must be enabled in BIOS/UEFI
- 4 GB RAM
In addition to the aforementioned requirements, if you want to run Docker in a Hyper-V guest VM, you need to enable nested virtualization by running this PowerShell command on the Hyper-V host:
Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $True
Make sure your VM is powered off before running this command. Without nested virtualization support, Docker will not work in a VM, and you will receive the error message shown below.
Install Docker using the GUI
To install Docker Desktop in Windows using the GUI, follow these steps:
Download Docker Desktop. You will see a configuration screen, as shown in the screenshot:
To use Docker with the WSL 2 backend, check the box that says Use WSL 2 instead of Hyper-V (recommended). If you want to use Hyper-V instead, uncheck this option and click OK.
When the installation is complete, click the Close and Restart button to restart your computer.
After restarting, you will be able to run Docker Desktop using either a shortcut or a command prompt. If you did not install WSL 2 before installing Docker, you will receive the WSL 2 installation is incomplete error when you try to start Docker.
To fix this error, run the wsl --update command in an elevated PowerShell console, and restart your computer.
Install Docker using winget
Winget is a command-line package manager for modern versions of Windows, which works just like apt or DNF in Linux. If you have a little experience with package installation in Linux, you probably know that you usually just have to type a command and the package is ready for use. Well, winget does the exact same thing in Windows. All you need is Windows 10 1809 (build 17763) or Windows 11. To install Docker in Windows using winget, follow these steps:
Launch an elevated command prompt or PowerShell console, and type the following command:
winget install --exact --id Docker.DockerDesktop --accept-source-agreements --accept-package-agreements
The --exact (or -e in short) parameter tells winget to find the package using an exact match. The installation can take a while, but it is pretty much automatic, so there is nothing you need to do but wait.
When the command is finished, open a new command prompt (or PowerShell console) and run the docker --version command.
If you try to run docker --version in the same command prompt, you will likely see The term 'docker' is not recognized as the name of a cmdlet, function, script file, or operable program error, as shown in the screenshot.
This error occurs because your current command session (cmd or PowerShell) is still using the old environment variables. To be able to recognize the newly added Docker variable, you must reload the environment variables. Launching a new command session is the easiest way to load new variables.
Install Docker using PowerShell
To install Docker Desktop using PowerShell, follow these steps:
Once the installer package is downloaded, open an elevated PowerShell console or Windows Terminal, and type the following command to start Docker installation:
Start-Process "D:\Docker Desktop Installer.exe" -Wait -NoNewWindow "install --quiet --accept-license"
Make sure you adjust the installer path. The -Wait parameter causes the Start-Process cmdlet to wait for the new process to finish, and the -NoNewWindow parameter prevents the new process from opening in a new window. The --quiet switch is offered by Docker's install command and suppresses the installation information. To see the information, skip this switch. Since we are using PowerShell, notice how --quiet and other flags are enclosed in quotes along with the install command—this is very important to avoid errors. By default, Docker will use the WSL 2 backend, but you could include the --backend=hyper-v flag to use the Hyper-V backend instead.
Once the above command is finished, you will see a shortcut for Docker Desktop on your desktop. Double-click the shortcut to launch Docker.
All of these installation methods are self-sufficient, so there is nothing additional you need to do. But you may still get an error message that says Docker Desktop – Access denied. You are not allowed to use Docker. You must be in the "docker-users" group.

Docker Desktop – Access denied. You are not allowed to use Docker. You must be in the docker users group
If you get this error, run the following command in an elevated PowerShell console:
Add-LocalGroupMember -Group "docker-users" -Member $env:UserName -Verbose
Don't forget to log off and log on again after running this command. If you want to delegate another user to run Docker Desktop, you can specify that username with the -Member parameter instead of $env:UserName.
Subscribe to 4sysops newsletter!
That was all for this guide. You just learned how to install Docker in Windows using the GUI, winget, and PowerShell. I am curious to know which method you prefer, and why.