Install Docker CE on WSL2 Without Docker Desktop

Published: (March 2, 2026 at 08:43 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Prerequisites

After setting up WSL2, you can install Docker CE directly in the distribution without using Docker Desktop.

Install dependencies

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release

Add Docker’s official GPG key

sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
  | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Set up the Docker APT repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
  | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io \
  docker-buildx-plugin docker-compose-plugin

Verify the installation

sudo docker run hello-world

Run Docker without sudo

sudo usermod -aG docker $USER

Open a new terminal for the group change to take effect.

Start the Docker daemon

WSL2 does not start systemd by default, so the Docker daemon must be started manually each time you open WSL2:

sudo service docker start

(Optional) Enable systemd support

If you are using Windows 11 version 22H2 or later, you can enable systemd in WSL:

[boot]
systemd=true

After adding the above to /etc/wsl.conf, restart WSL2. Docker will then start automatically.

0 views
Back to Blog

Related posts

Read more »

Google Gemini Writing Challenge

What I Built - Where Gemini fit in - Used Gemini’s multimodal capabilities to let users upload screenshots of notes, diagrams, or code snippets. - Gemini gener...