How to Install Docker on Windows 10: A Step-by-Step Guide

In this guide, we will walk you through how to install Docker on Windows 10, step by step, and discuss the prerequisites, benefits, and use cases for Docker.

Lucas

By Lucas / Published on October 10, 2024

Share this: instagram reddit

Docker is a powerful platform that allows developers to create, deploy, and manage applications inside containers. Containers are lightweight, standalone, and executable software packages that include everything needed to run an application, such as the code, runtime, system tools, and libraries. If you're a developer or IT professional working on Windows 10, Docker can be an invaluable tool for developing, testing, and deploying applications in a consistent environment.

Why Use Docker on Windows 10?

Before diving into the installation process, let’s take a moment to explore why Docker is a great option for developers on Windows 10:

  1. Consistency Across Environments: Docker ensures that your code runs the same on your local development machine as it does on production servers, eliminating the "it works on my machine" problem.
  2. Isolation: Containers run in isolation from each other and the host system, which minimizes potential conflicts between different projects and software dependencies.
  3. Portability: Docker containers can be easily moved between different environments, including local, cloud, and hybrid infrastructure.
  4. Efficiency: Docker is lightweight and doesn't require a full operating system to be packaged with your application, leading to faster boot times and less overhead compared to virtual machines.
  5. Version Control for Environment: Docker allows you to version control the environment configuration, making it easy to replicate setups.

Prerequisites for Installing Docker on Windows 10

Before you begin installing Docker on your Windows 10 machine, there are a few things to keep in mind:

  1. Windows 10 Version: Docker Desktop requires Windows 10 Pro, Enterprise, or Education with version 1903 or later. If you're using Windows 10 Home, you will need to use the Windows Subsystem for Linux (WSL 2) backend, which we'll discuss later in this guide.

  2. Enable Hyper-V and Virtualization: Docker relies on virtualization, so you need to enable Hyper-V and Container features on your system. We’ll walk you through this process if it’s not already enabled.

  3. 64-bit Processor: Docker requires a 64-bit processor with second-level address translation (SLAT).

Step 1: Enable Hyper-V and Virtualization

Before installing Docker, you need to ensure that Hyper-V, Windows Containers, and Virtualization are enabled.

1.1 Enable Hyper-V

Hyper-V is Microsoft’s virtualization technology required to run Docker. Here’s how to enable it:

  1. Open Control Panel and go to Programs > Turn Windows features on or off.
  2. Scroll down and check the boxes for Hyper-V and Windows Containers.
  3. Click OK to apply changes, and restart your computer if prompted.

Alternatively, you can enable Hyper-V via PowerShell with the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

1.2 Enable Virtualization in BIOS

Virtualization technology must be enabled in your system’s BIOS. Here's how:

  1. Restart your computer and enter the BIOS setup (usually by pressing a key like F2, F10, or DEL during startup).
  2. Navigate to the Advanced tab, and look for Intel Virtualization Technology (Intel VT) or AMD-V.
  3. Enable the setting, save, and exit the BIOS setup.

Once Hyper-V and virtualization are enabled, you're ready to install Docker.


Step 2: Download Docker Desktop for Windows

2.1 Visit the Docker Website

To get started with Docker on Windows 10, you need to download Docker Desktop. Go to the official Docker website:

2.2 Choose the Correct Version

Make sure to download the version of Docker Desktop that corresponds to your Windows 10 version:

  • Windows 10 Pro, Enterprise, or Education: You can install Docker Desktop with Hyper-V.
  • Windows 10 Home: You will use Docker Desktop with WSL 2 as the backend.

Once downloaded, run the installer.

Step 3: Install Docker Desktop

3.1 Run the Installer

After downloading Docker Desktop, follow these steps to install it:

  1. Double-click the downloaded Docker Desktop Installer.exe file.
  2. If prompted by User Account Control (UAC), click Yes to allow the installer to make changes to your device.
  3. In the setup window, check the box to enable WSL 2 if you're on Windows 10 Home.
  4. Click Install to start the installation process.

Docker Desktop will now install on your machine. This might take a few minutes.

3.2 Complete the Setup

Once the installation is complete:

  1. The Docker Desktop icon should appear in your taskbar. Click it to open Docker Desktop.
  2. You may need to sign in with your Docker ID (create one for free if you don’t already have an account).
  3. After signing in, Docker Desktop will ask if you want to use Hyper-V or WSL 2 as your backend. Choose the appropriate option based on your Windows version:
    • Windows 10 Pro/Enterprise: Use Hyper-V.
    • Windows 10 Home: Use WSL 2.

3.3 Verify Installation

To verify that Docker is installed correctly, open a Command Prompt or PowerShell window and run the following command:

docker --version

This should return the Docker version installed on your system.


Step 4: Configure Docker Desktop

Once Docker is installed, there are a few additional configuration steps you can take to optimize your Docker environment.

4.1 WSL 2 Backend (Windows 10 Home Users)

If you selected WSL 2 as your backend, Docker Desktop will install a Linux kernel component. Ensure you have WSL 2 enabled by running this command:

wsl --set-default-version 2

If you don’t have WSL 2 installed, Docker Desktop will prompt you to install it. Follow the on-screen instructions.

4.2 Resource Allocation

By default, Docker allocates a portion of your system’s CPU and memory for container use. You can configure these settings:

  1. Click on the Docker icon in the system tray and select Settings.
  2. Go to the Resources tab and adjust the CPU, Memory, and Disk settings based on your system’s capacity and your requirements.

Step 5: Running Your First Docker Container

Now that Docker is installed and configured, let’s run a simple container to test everything.

5.1 Pull a Test Image

To start, pull a test image from Docker Hub. Open PowerShell or Command Prompt and run:

This command downloads the hello-world image and runs it in a container. If successful, you’ll see a confirmation message explaining how Docker worked.

5.2 Create Your Own Dockerfile

To experiment further, you can create a simple Dockerfile that defines an environment for your application. Here’s a basic example:

# Use an official Python runtime as a base image FROM python:3.8-slim-buster # Set the working directory in the container WORKDIR /app # Copy the current directory contents into the container COPY . /app # Install the required packages RUN pip install --no-cache-dir -r requirements.txt # Run the application CMD ["python", "app.py"]

Build and run the Docker container with:

docker build -t my-python-app . docker run -p 5000:5000 my-python-app

Further tips: Protect Your Windows Computer Using Professional Disk Management Tool

Powerful disk management tool AOMEI Partition Assistant can fully solve built-in disk partition manager shortcomings in Windows 10. It works with Windows 7, 8, 10, 11. For Windows, the AOMEI Partition Assistant lets you extend a partition independent of whether there is unallocated space immediately adjacent to the extended partition. The Resize/Move Partition Feature of AOMEI Partition Assistant can help to enlarge the partition by using the unallocated space only if it exists adjacent to the partition on either the left or the right side.

Features AOMEI Partition Assistant Pro Windows 10 Disk Management
Create partition, delete partition, format partition, change drive letter
Extend/Shrink NTFS partition
Extend/Shrink FAT32 partition
Merge partitions, merge unallocated space, move partition
Allocate free space from one partition to another
Convert MBR to GPT / GPT to MBR  without data loss
Convert dyanmic disk to basic disk without data loss
Convert primary to logical/logical to primary  partition without data loss
Convert NTFS to FAT32 without formatting
Migrate OS to SSD or HDD
Make Windows PE bootable disc
Recover lost/deleted partition
Clone disk/partition
Move folder / Apps
Schedule defrag disk partition
Test Disk Speed
Change serial number, change partition type ID

Conclusion

Docker makes it incredibly easy to package and distribute applications by leveraging containers. In this guide, we covered how to install Docker on Windows 10, step by step, including enabling Hyper-V and virtualization, downloading Docker Desktop, and configuring Docker for optimal performance. We also ran our first container to test the installation and discussed creating a Dockerfile.

Docker’s flexibility and portability make it a valuable tool for developers working in a variety of environments. Whether you’re running microservices, testing new applications, or deploying to the cloud, Docker ensures consistency, efficiency, and ease of use.

Lucas
Lucas · Staff Editor
I prefer peaceful and quiet life during vacation,but sometimes I watch football match if my favorite club performs brilliantly in that season. And I love reading, painting and calligraphy, thus I send my friends festival handwriting cards every year.