How to Install Docker on Windows

Today I will be covering how to install Docker on Windows 10 Home or Pro version. Docker is an open platform that can be used for deploying applications using isolated and secured containers. Docker containers are lightweight, easy to configure and work consistently in production environments.

In the previous post, we looked at how to install Docker in Ubuntu 18.04, today I will show you how you can install Docker on Windows. Docker installation process on Windows is fairly simple, but you need to know some tricks to get Docker working on Windows.

Installing Docker on Windows

There are two ways to install Docker on Windows, the first one is by installing Docker Desktop application and the second is by installing Docker Toolbox. I personally install Docker on Windows using Docker Toolbox, because this method will work on Windows older versions such as Windows 7, Windows 8 and Windows 10 Home Edition. According to the official documentation of Docker, Docker can be installed on Windows with the following system requirements.

  • Windows 10 64 bit: Pro, Enterprise or Education (Build 15063 or later)
  • Hyper-V and Container features enabled
  • 64-bit processor
  • Minimum 4GB system RAM
  • BIOS-level hardware virtualization support

As you can see from the above requirements, Docker can not be installed on Windows 10 Home or older versions. To install Docker on older versions of Windows, you can use the Docker Toolbox which uses Oracle Virtual Box instead of the Hyper-V feature of Windows.

Docker Toolbox installer comes with everything you need to configure and launch a Docker environment. Docker Toolbox allows you to deploy development containers in legacy Windows systems. Docker Toolbox comes with the following tools:

  • Docker Machine
  • Docker Engine
  • Docker Compose
  • Kinematic
  • Oracle VirtualBox
  • Docker Quickstart Terminal App

Checking System Configuration

The first step is to check if your system configuration meets the requirements needed for running the Docker installer successfully.

Checking Windows Version

Docker Toolbox requires 64-bit Windows. There are several ways to verify if your machine is running a 64-bit based Windows or not.

To check the OS version in Windows 10, follow below steps:

  • Type Settings in the Windows Search Box and select System.
  • Now click on the About tab.
  • On this screen, you can find the Windows edition and version under the PC name.
  • Look for System Type to check if you are running a 32-bit or 64-bit version of Windows.
Docker on Windows - System Settings
Docker on Windows – System Settings

Enable Hardware-Assisted Virtualization

Enabling hardware-assisted virtualization is mandatory for installing Docker Toolbox. You can check if your system supports this technology, by completing the following steps.

  • Type Task Manager in the Windows Search Box.
  • Click on the Performance tab. Look under CPU to find out if virtualization is enabled or not.
Docker on Windows - Virtualization Check
Docker on Windows – Virtualization Check

How to Install Docker on Windows Home/Pro

Once you have verified the system requirements, download the Docker Toolbox installer from the Docker website.

Click the download button with the Windows logo.

Docker Toolbox will install the following applications:

  • Docker Client for Windows
  • Docker Toolbox Management tool and ISO
  • Oracle VirtualBox
  • Git MSYS-git UNIX Tools

Important

If you have VirtualBox installed on your computer, I recommend you uninstall before running the Docker Toolbox Installer. I have noticed, some issues can arise if you have already installed the VirtualBox, instead install the VirtualBox through Docker Toolbox.

These are the steps you must follow for completing the Docker Toolbox installation.

  • Open the installer by double-clicking the .exe file. Choose Yes in the Windows security dialog box to allow the program to make changes to your PC.
  • When the Docker Toolbox setup starts, click the Next button.Install Docker on Windows - 1
  • Choose the local folder for the Docker Toolbox installation. Click the Next button.
  • Check the components to be installed. In my case, I have checked all as I don’t have the VirtualBox and Git installed.
    Install Docker on Windows - 2
  • Accept all default options and click the Next button.
    Install Docker on Windows - 3
  • Verify that all selected components will be installed. Click Back to make any changes.
  • Click the Install button to finish the installation.
    Install Docker on Windows - 4
  • After all the components are installed, the wizard will notify that installation was successful. Uncheck view Shortcuts in File Explorer and click Finish.

Important Fixes Before Verifying Docker Installation

Until now we have installed the Docker, if you have Hyper-V installed as I do, the instructions will not work right out of the box. If you try to start the Docker Quickstart Terminal, you’ll get the following error message:

Running pre-create checks…
Error with pre-create check: “Hyper-V is installed. VirtualBox
won’t boot a 64bits VM when Hyper-V is activated.
If it’s installed but deactivated, you can use –virtualbox-no-vtx-check to try anyways”
Looks like something went wrong in step ´Checking if machine default exists´

The issue is that when you run the Docker QuickStart Terminal the very first time, the startup script attempts to create the default virtual machine in which the Docker containers will run. This step will fail if you have the Hyper-V installed, even if it is disabled.

Before running the startup terminal for the first time, we need to make some modifications to the start.sh file located at C:\Program Files\Docker Toolbox. To modify this file, you will have to open the file in an editor running as Administrator.

In your editor, locate the following code snippet:

STEP=”Checking if machine $VM exists”
if [ $VMEXISTSCODE -eq 1 ]; then
“${DOCKERMACHINE}” rm -f “${VM}” &> /dev/null || :
rm -rf ~/.docker/machine/machines/”${VM}”
#set proxy variables if they exists
if [ -n ${HTTPPROXY+x} ]; then
PROXYENV=”$PROXYENV –engine-env HTTPPROXY=$HTTPPROXY”
fi
if [ -n ${HTTPSPROXY+x} ]; then
PROXYENV=”$PROXYENV –engine-env HTTPSPROXY=$HTTPSPROXY”
fi
if [ -n ${NOPROXY+x} ]; then
PROXYENV=”$PROXYENV –engine-env NOPROXY=$NOPROXY”
fi

“${DOCKERMACHINE}” create -d virtualbox $PROXYENV “${VM}”
fi


We want to make changes to the second last line where the virtual machine is created.

Change the below line:

“${DOCKER_MACHINE}” create -d virtualbox $PROXY_ENV “${VM}”

To this:
“${DOCKER_MACHINE}” create -d virtualbox –virtualbox-no-vtx-check $PROXY_ENV “${VM}”

You have noticed that we simply added the --virtualbox-no-vtx-check to the line.

Save your changes and now you should be able to run the quickstart terminal without any issues and after a few moments, you will be prompted with the welcome message like below.

                       ##         .
## ## ## ==
## ## ## ## ## ===
/”””””””””””””””””\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/

docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com

Start interactive shell

Verifying Docker Installation

Once you have Docker Quickstart Terminal loaded, you can verify the Docker installation by checking the Docker’s version.

Run below command in the terminal to check Docker’s current Build.

$ docker –version
Docker version 19.03.1, build 74b1e89e8a

Running First Container in Docker

To download your very first container from the Docker Hub, run below command in the terminal.

docker run hello-world

The above command will pull the hello-world image from the repository and run it. You will be presented with the message from the container.

Final Word

In this post, we have successfully installed the Docker on Windows operating system.

If you have any comments or suggestions about this post, please let us know in the comments box below.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*
*