Windows

How to Install Docker on Windows 10

How to Install Docker on Windows 10

Complete guide to installing and running Docker with a Hyper-V or WSL backend on a Windows 10 PC

Docker is a tool that allows developers to quickly create, deploy, and run applications using containers. The concept of containerization is an approach in which the application, its dependencies and configuration are all packaged in one file known as a container.

Containers are somewhat similar to Virtual Machines, but instead of running the entire OS and all its services, they only run the minimum required by software that is packaged as a container and depends on the host OS for the most part. This container has better performance than running a complete Instance and is isolated from the host OS environment.

In this article, let’s look at how to install Docker and enable Hyper-V and WSL to run containers on Windows 10.

Precondition

You need Windows 10 64-bit Pro, Enterprise or Education edition with 1703 updates or newer (build 15063 or newer) to use Hyper-V backend or Windows 10 64-bit with 2004 or newer updates (build 19041 or newer ) for the WSL backend. In addition, a modern 64-bit processor is needed with virtualization support and a minimum of 4GB RAM.

In addition to the requirements above, you need virtualization support that is enabled in the BIOS. To check whether you have activated virtualization, open Task Manager and open the Performance tab.

1

If virtualization is displayed as ‘Disabled’, you must enable it in the BIOS settings. Depending on the motherboard and CPU you have, the steps to enable virtualization are different.

For Intel processors, activate a setting called Intel Virtualization Technology (VT-x) in the BIOS. Likewise, for AMD the processor activates a setting called SVM mode in the BIOS. See your motherboard’s manual to find the individual settings for your CPU.

Install Docker through Winget

Docker is available in the Winget repository, so it can be installed using a simple command. If you have not installed the winget tool and want to learn more.

We will install the stable release of Docker available in the Winget repository. Open PowerShell or CMD and run the following command to install it.

winget install -e --id Docker.DockerDesktop

2

The UAC prompt will ask permission to make changes, click ‘yes’ to continue installing Docker Desktop. Soon Docker will be installed on your system.

But we can’t yet run Docker, before doing so we have to activate Hyper-V or WSL for Windows 10 or Docker will throw an error and won’t start. We will discuss this later in this guide.

Download and install Docker Manually

If you want to install Docker manually, open the Docker Desktop Download page and then click the “Download for Windows (Stable)” button to download the installer file.

3

Then, open your download folder and double click on the ‘Docker Desktop Installer’ setup file to start the installation process.

4

You will be presented with a configuration window in the setup process. Check Enable Windows WSL 2 Feature ‘if you are using Windows 10 Home edition or want to use the WSL 2 Docker backend and Check’ Add shortcut to desktop ‘if you want the Docker Desktop shortcut, then press’ OK’ to start the installation.

5

After the Docker Desktop settings finish uninstalling and installing the file, click the ‘Close and restart’ button to complete the docker installation process.

6

Enable Hyper-V or WSL?

Now all that’s left is to enable Hyper-V or WSL depending on the Windows 10 edition and version you have.

  • Windows 10 Pro, Enterprise & Education edition with 1703 updates or newer: If you are not on a 2004 or newer update, only the Hyper-V backend can be used.
  • Windows 10 Home edition with a 2004 update or newer: Only WSL can be activated because the Hyper-V feature is not available in the Home edition.
  • Windows 10 Pro, Enterprise & Education edition with update 2004 or newer: Hyper-V & WSL can be activated and used with docker.

Activate Hyper-V

Hyper-V is the original hypervisor for Windows 10 that can be used to create and run virtual machines. Hyper-V is on the route to become a legacy option for running containers in Windows 10, because docker plans to use WSL as its main backend to run containers.

But you still need Hyper-V if you want to run the original Windows Docker container. Thus to activate Hyper-V, open PowerShell as an administrator and run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All

7

PowerShell will ask you to restart the computer to complete the Hyper-V installation, type Y and press enter to do the same. After rebooting the computer, you can run Docker Desktop and use the container.

Activate WSL

Windows Subsystem for Linux (WSL) is a compatibility layer that allows users to run Linux applications natively on Windows 10. The Docker WSL backend allows users to run native Linux Docker containers on Windows without Hyper-V emulation.

If you have the latest Windows 10 2004 update, it is recommended to use WSL as a Docker backend because it performs better than the Hyper-V backend. Windows 10 Home edition users have no choice but to use the WSL backend for Docker because the Home edition does not have a Hyper-V feature.

If you have checked ‘Enable Windows WSL 2 Features’ in the settings, this command can be skipped because the Docker Settings automatically activates WSL. Go to the ‘WSL Update’ section below to continue the process.

Open PowerShell as an administrator then run the following command to activate the WSL and WSL components “Virtual Machine Platform” for Windows 10.

Enable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")

Press ‘Y‘ and press enter to restart the computer and complete the process.

8

WSL update

After you complete the Docker Installation and restart the system, when you run Desktop Docker you will see an error as shown below.

9

Click this link or the link in error to go to the Microsoft Docs page with the latest WSL2 kernel update. Then click the “download the latest WSL2 Linux kernel” link on the page as shown below to download the “wsl_update_x64” setup file.

10

Double click on the settings file you downloaded in the steps above and press ‘yes’ when asked for permission.

11

After you activate and update WSL for Windows 10, you can run Docker to find it in the Start menu.

12

Switch between Backend Hyper-V & WSL

If you have activated Hyper-V & WSL, you can use the backend and switch between the two to use Windows Containers or Linux Containers.

Switch to the Hyper-V backend by opening the Docker system tray icon, right clicking on it and selecting the ‘Change to Windows container’ option. Likewise, you can switch to the WSL backend by selecting the ‘Switch to Linux’ option.

13

Verify the Docker Installation

The white whale in the system tray shows that Docker is running. But you can also test the docker installation by opening PowerShell or CMD and typing the docker version

PS C:\Users\ATH> docker --version
Docker version 19.03.8, build afacb8b

14

Next, try dragging the hello-world image and running the container by running the docker run the hello-world command in PowerShell or CMD:

PS C:\Users\ATH> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:6a65f928fb91fcfbc963f7aa6d57c8eeb426ad9a20c7ee045538ef34847f44f1
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

This message shows that our Docker installation was successful and we are ready to draw images and make containers.

Related posts

How to Setup and Configure Multiple Monitors on Windows 10

Windows

How to clean Windows

Windows

How to Install iPhone Notes Apps on Windows 10

Windows

How to Open Registry Editor in Windows 10

Howto

How To Set Parental Controls On Xbox, Windows 10 And Android

Howto

Windows 10 Buggy Hardware Driver Update Is Being Repaired

Howto

How to Activate and Use Clipboard History in Windows 10

Windows

How to fix Windows 10 blue screen crashes

Windows

How to add filters to images in the Photos apps in Windows 10

Windows