Docker is one of the most popular technologies of recent years. It has completely revolutionized how developers build and ship applications across platforms.
Docker itself is a free and open-source platform that allows developers to build, package, deploy, and run applications in containers. A docker container refers to a standalone environment that combines all the tools and dependencies required to run an application, regardless of the environment.
A docker container will include a base operating system, all networking resources, disk spaces, and all the libraries and dependencies required to run a specific code.
This means as developers, we only need to worry about the code and not worry about provisioning infrastructure or configuring tools for a specific environment.
In this tutorial, we will discuss how you can set up Docker on your Windows machine in quick and easy steps.
Before we proceed further, Docker requires you to have the Windows Subsystem for Linux Enabled for your system. This is only available in 64-bit versions of Windows and higher.
For Hardware requirements, Docker recommends the following resources:
- 64-Bit Processor
- At least 4GB of Memory
- BIOS Virtualization Enabled
With that out of the way, let's proceed.
Enable Virtualization and WSL
The first step to getting Docker on Windows is to ensure you have Virtualization Enabled for your system. Feel free to check your manufacturer's documentation on how to enable virtualization for your machine.
Next, open the Windows start menu and search for "Turn Windows Features on or off":
In the Next Windows, Locate the "Virtual Machine Platform" and "Windows Subsystem for Linux" features and ensure they are marked.
Finally, Click "OK" to save the changes and apply the features. This may require you to restart your machine.
Next, open the command prompt as administrator and run the command:
The command above will enable and install the required components for WSL version 2.
Once installed, change the default WSL version to WSL 2 by running the command:
wsl --set-default-version 2
You can verify this by running the command:
wsl -l -v
The command above should return the installed Linux distributions and the current WSL version. An example output is as shown:
wsl -l -v
NAME STATE VERSION
* Debian Stopped 2
From the output above, we can see Debian is installed on WSL version 2.
NOTE: In some cases, you may need to manually enable WSL version 2 by installing the WSL2 Kernel Package.
To do so, start by downloading the kernel package installer in the resource below:
Next, launch the installer and follow along with the provided instructions. This may require you to restart your system to apply the changes.
Once the initial setup is complete, it's time to install Docker on our system.
Start by downloading the Docker Desktop in the resource provided below:
Once downloaded, launch the installer wizard and follow along with the provided instructions.
Ensure to select "Use WSL 2 instead of Hyper-V" in the configuration page.
Once completed, click close to complete the installation process.
Start Docker Desktop
Once installed, you will need to start the Docker service before you can perform any Docker operations.
Clock on the start menu and search for Docker desktop. Click to star.
This should start the docker service and allow you to perform operations such as running containers.
And with that, we have come to the conclusion of this guide. Here, you learned how to set up and configure your system to run Docker.