How to Install Docker on Windows 10?
Practically, all the top organizations around the world have digital services that depend on Docker containers for running their applications.
With a Windows installer and a well-documented installation procedure, Docker on Windows has become one of the famous containerization platforms.
To set it up, most of us download and use the executable file available on the official website of the containerization platform, but you don’t have to do all that.
Just use the command line and ensure that the WSL is already enabled on your device, then follow the given steps, and you are done.
What is Docker?
Docker is an open-source project that makes it possible to build, run, manage, and distribute far more apps. Also, Docker makes it easy to create containers and container-based apps.
Originally built for Linux, but now Docker runs on Windows and macOS as well. Before heading towards understanding how Docker works, let’s first know the required components you would use to create containerized applications in Docker.
As evident in this picture, every app runs on separate containers and has its own set of dependencies & libraries. With this, developers can easily build apps without the fear of interfering with one another.
Components Installed with Docker
1. Docker Engine
The Docker engine contains the Docker daemon, REST API for interacting with the Docker daemon, and a CLI client that communicates with the daemon. Docker daemon accepts Docker commands – such as Docker run and Docker build – from the Docker client.
2. Docker Compose
This component is used to run multiple Docker containers at once by running a single command, which is docker-compose up.
3. Docker Machine
To install the Docker engine, we need to use a Docker machine. Docker Machine has its own command-line client docker-machine and the Docker Engine client, docker.
This is an open-source project built to simplify the use of Docker on Windows. It provides an interactive user interface for running Docker containers although It helps to automate the installation of Docker.
5. Boot2Docker ISO
It is a tiny Linux distribution that will help you to run Docker on Windows.
It is an open-source hypervisor for Windows used to emulate operating systems.
Pros of Working with Docker on Windows
- Maintaining parity between testing and productiondeployment.
- Running different versions of the same application.
- Use the same toolset on both Windows and Linux.
- Hypervisor containers provide a solution for enhancing the security of your Windows app deployments.
- Enables faster software delivery cycles.
- Facilitates application portability.
- Solves different environment-based problems.
For creating an optimized and fast container environment to run various virtual machine images, you will need to learn the commands to use on Powershell for installing Docker on Windows 10 using WSL 2 support.
This is what we are going to explain in this blog. So without wasting any more time, let’s deep dive into installing Docker on Windows.
Why Utilize a WSL (Windows Subsystem for Linux) for Installing Docker on Windows?
WSL makes it very easy to operate Docker without Hyper-V or VirtualBox. The Windows Subsystem for Linux comes with the ability to run a full-fledged Linux kernel using WSL 2. The best part of WSL is that it is already available in Windows 10.
Prerequisites for Installing Docker on Windows 10
- Windows 10 Pro
- Administrator access to Powershell
- A reliable internet connection
1. Get Windows 10 Pro Ready
Before heading to install Docker on Windows 10, just make sure your Windows 10 is Windows 10 Pro otherwise you cannot install Docker on Windows 10.
2. Time to get Admin access
To run the installation command for Docker, We will require the Administrator access of PowerShell.After getting the admin access just right-click on the Windows 10 Start button and lastly, click on the “Windows PowerShell (Admin)”.
3. Download Docker
You can directly install Docker from the Docker Store. You will need to create an account to download it. Having an account for Docker will allow you to download Docker images in the future.
Just go to the Docker official page and Click on Products -> Docker Desktop on the menu bar. You will now be at the Docker Desktop product page, which looks like this:
Here you will have a button labeled “Download Docker Desktop for Windows.” Just click on it.
Note: The size of this installer file for Windows is around 914 MB.
4. Install Docker Desktop on Windows
To run the Docker installer, simply double-click the Docker Desktop Installer.exe file.
You can get it from Docker Hub If you haven’t downloaded the Docker installer (i.e. Docker Desktop Installer.exe). Though it downloads to your Downloads folder by default, you can run it from the recent downloads bar at the bottom of your web browser, if using Google Chrome.
The Docker installation will start now. Now you need to:
- Ensure the Enable Hyper-V Windows Features option is selected on the Configuration page.
- To authorize the installer and proceed with the install, follow the instructions on the installation wizard.
- Click Close to complete the installation process once the installation is successful.
- You must add the user to the docker-users group if your admin account is different from your user account. After that, simply Run Computer Management as an admin and navigate to:
Local Users and Groups > Groups > docker-users
- After doing so, add the user to the group. To do so right-click on the add option. For the changes to take effect, log out, and log back in.
Use this command to install Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Now make sure that Chocolatey is installed. Go ahead and close the Powershell and reopen it as Admin and check if Chocolatey is installed by typing the following in the terminal window:
Next, run Chocolatey in your PowerShell with admin rights.
After completing the above steps, everything is ready on Powershell, and you are good-to-go to install Docker on Windows 10 Pro or Windows Server 2019.
Now, use the command written below:
choco install docker-desktop –pre
While running the above command, it will ask for your permission to install the packages. To allow it, just type A and hit Enter.
To run the open-source containerized platform, just double-click on the Docker icon on your desktop or system tray.
Configure WSL 2 Distro
After completing the Docker installation, Docker will install its own WSL 2 Linux distro on your device and set it as the default one. Hence, users can easily initiate it using PowerShell.
Just go to the Docker Desktop app, click on the Resources option given on the left side, and simply select the WSL integration option. On the off chance, you might need to enable the Docker support to other available WSL Linux distros on your system.
By doing so, you will find all installed and available WSL distros there. To enable Docker support, use the toggle button present in the front of the Linux distro. Now, you can easily run all the Docker commands.
How Does Docker Work?
Docker works a lot similar to Visual Studio Code’s WSL remote development support. The Docker command-line interface running on the Docker host machine executes commands within the Docker Integration Package, which runs on the remote WSL VM.
There’s no need for the Hyper-V, as Docker runs directly within WSL and all Linux containers run within the Linux userspace on Windows for enhanced performance and compatibility.
Uninstall Docker Desktop
To uninstall Docker Desktop from your Windows machine:
- Go to the Windows Start menu and navigate to Settings > Apps > Apps & features.
- From the Apps & features list, Select Docker Desktop and then select Uninstall.
- To confirm your selection, Click Uninstall.
The Final Take
Well, we shared everything that a person should know and follow for successfully installing Docker on Windows. We hope that this blog helps you.
If you still have any confusion or any concern about installing Docker on Windows or you find something wrong in this article, let us know by leaving your query in the comments section below. We will get back to you at the earliest possible.