Sometimes, you want I want to run on Docker container on Windows, but I don’t want to have to worry about using Docker Desktop. Instead, I use Windows Subsystem Linux (WSL) in conjunction with the Docker engine via a terminal window. In this guide, I’ll show you how to install Docker on Windows 10 or 11 without using Docker Desktop.
Enable WSL and install a Linux Distribution
Open PowerShell or CMD as administrator and run:
wsl --install
Restart your computer if prompted.
Install a Linux Distribution, if you run ubuntu
in Powershell wsl
will install the respective distribution for you and then you’ll create a UNIX username and password.
Set WSL Version to 2
In Powershell, set the default WSL version to 2 using the following command:
wsl --set-default-version 2
Install Docker Engine in WSL
Launch your installed Linux distribution and update package lists
sudo apt update
Install Docker’s package dependencies
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Add Docker’s official GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add Docker repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
Install Docker Engine
sudo apt update
sudo apt install docker-ce
Start the Docker Service
sudo service docker start
Run Docker Without sudo (optional, but recommended)
Add your user to the Docker group
sudo usermod -aG docker $USER
Restart your terminal or start a new terminal instance and validate that you can now run docker without sudo
.
Test Docker Installation
Run a test container
docker run hello-world
This setup allows you to run Docker containers in on Windows without the need of Docker Desktop by leveraging WSL 2.
If you need any assistance with your configuration, please leave a comment below.
Leave a Reply