Skip to Content

Install Docker Engine on WSL

Learn how to install Docker Engine on WSL.

karchunt

Kar Chun Tan

Creator

Metadata

Tue Jan 27 2026

2 min read

236 words

Install Docker Engine on WSL

Before installing Docker Engine on WSL, make sure you have WSL installed and running. If not, you can install it by following the instructions in the Mastering WSL post.

Setup Docker’s apt repository

The main reason we need to setup Docker’s apt repository is to ensure that we’re installing the latest version of Docker Engine on WSL. By default, the apt repository only contains the stable version of Docker Engine, which may not be the latest version.

# Add Docker's official GPG key: sudo apt update sudo apt install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: sudo tee /etc/apt/sources.list.d/docker.sources <<EOF Types: deb URIs: https://download.docker.com/linux/ubuntu Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") Components: stable Signed-By: /etc/apt/keyrings/docker.asc EOF sudo apt update

Install the Docker packages

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

By default, the Docker service will start automatically after installation. You can verify it by using the following command:

sudo systemctl status docker

If it is disabled, you cam enable it by running the following commands:

sudo systemctl enable docker sudo systemctl start docker

Verify the installation

sudo docker run hello-world

By default, you need sudo access to run Docker commands. To avoid this, you can add the current user to the docker group.

sudo groupadd docker sudo usermod -aG docker $USER newgrp docker # check the access docker run hello-world
Last updated on