Running Docker in WSL2 Ubuntu Distro without Docker Desktop

In this post, I will show you how to run Docker commands in WSL2 without Docker Desktop

Utkarsh Shigihalli
3 min readMar 7, 2024

I have been using Docker on WSL2 without Docker Desktop for a while now and recently I had to rebuild my Ubuntu distro. I had to go through installing the Docker Engine once again following a series of steps, so thought I will document so that I can use it again as a reference.

This post is just that and I hope others will find it useful too.

Prerequisites

Before installing Docker in WSL2, first make sure you are running WSL2. You can do that using wsl --version in your PowerShell which should output as below.

You can also check you are running the Ubuntu version using lsb_release -a command which should output as below

Installing Docker

Now that you confirmed you have the prerequisites, let's start by installing Docker. Docker documentation provides a convenient script for us to run, which just involves running the script below.

--

--

Utkarsh Shigihalli

Microsoft MVP | Developer | Passionate about Cloud, .NET and DevOps