Table of contents
Sometimes, the Docker Desktop app for Windows can behave in an unexpected way. The app might be correctly installed, but loading the docker engine will be impossible for it. This was my experience during a recent project, where I encountered a recurrent "failed to start the Docker Engine" error that nearly derailed things.
In this guide, I explain the reason behind this behavior and provide measures to help you resolve it. The solutions provided here apply specifically to Windows devices and are sourced from various resources across the web. I have organized them here to save you from the rigors of navigating conflicting information.
Ineffective Solutions
Before discussing what worked, here are the measures that will likely not solve the problem:
Removing and reinstalling the app
Deleting configuration files
Restarting the computer
Installing a Linux distro (Ubuntu for example)
With the ineffective measures out of the way, the next two sections will explore the underlying cause of the error and present effective solutions.
The Problem
By default, Docker Desktop is a Linux-based application. This creates compatibility issues with the Windows operating system, as the environments are fundamentally different.
The Solution
To address the compatibility issue, you need to install a Linux platform on your device and enable Windows' virtualization feature. Both measures will allow you to run Linux environments, such as Docker Desktop, on a Windows device. Here is how to go about them:
Note: Ensure you have installed the Docker Desktop app before proceeding.
Step 1: Enable Virtualization
The steps to enable virtualization depend on your PC manufacturer. For example, here’s how to enable virtualization on HP EliteBook PCs:
Turn on the computer, and then press f10 immediately to enter BIOS.
Use the arrow keys to select the Advanced tab.
Under the Advanced tab, use the up and down arrows to select System Options, and then press enter.
In the System Options window, select the Virtualization Technology (VTx) box.
Press f10 to save your changes and exit BIOS.
The process may vary for different HP models. Popular brands such as Dell, Acer, Asus, Lenovo, and others each have their own methods for enabling virtualization.
Step 2: Turn on Virtual Machine Platform
In addition to virtualization, you also need to enable the Windows Virtual Machine Platform. Here’s how to do that:
Select Start, enter Windows features in the search field, and select Turn Windows features on or off from the list of results. Alternatively, go to Control Panel > Programs > Programs and Features > Turn Windows Features On or Off.
In the Windows Features window that opened, find Virtual Machine Platform and select it.
Select OK to save your changes.
Step 3: Install the Windows Subsystem for Linux (WSL)
To install the Windows Subsystem for Linux, follow these steps:
Open Windows PowerShell: Select Start, enter Windows PowerShell in the search field, and select Windows Powershell from the results. Choose “Run as administrator” when opening the app.
Install or Update WSL: In PowerShell, run the command
wsl --update
to install or update WSL.Check installation status: Run the
wsl --version
command to check if the installation was successful. If it was, you should get an output similar to the image below.Set the Default WSL Version: Run the command
wsl --set-default-version 2
to set WSL 2 as your default version.Close PowerShell: Type
exit
and press Enter to close PowerShell.
Step 4: Restart your device (optional)
Restart your device, then open the Docker Desktop application again.
Additional Troubleshooting Tips
The Docker Engine should now be starting as expected. However, if the error persists after completing the steps in the previous sections, consider the following:
Enable Hyper -V: Hyper -V is an alternative to WSL, though Docker Desktop recommends WSL over Hyper-V. To enable Hyper-V, follow these steps:
Select Start, enter Windows features in the search field, and select Turn Windows features on or off from the results. Alternatively, go to Control Panel > Programs > Programs and Features > Turn Windows Features On or Off.
In the Windows Features window, find Hyper -V and select it.
Select OK to save your changes.
Restart your device, then open Docker Desktop.
Downgrade Your App: Your device may not support the current version of Docker Desktop you are running, so downgrading to an older version might help. Here is a link to different versions of the app.
Future Issues with the Docker Engine
Follow these steps to get the Docker Engine running again if it fails to start in the future after previously running successfully:
Reset the Docker Desktop app to default settings
Restart the app
Restart your computer (optional)
To Summarize
This guide effectively addresses the Docker Engine startup error, particularly for Windows 10 and 11. If you still encounter the error after implementing the recommendations here, there are likely other underlying causes. Fortunately, resources like the Docker community forum, Stack Overflow, YouTube, and others are available to assist you further.