Install Docker in WSL2 (Ubuntu) without Docker Desktop

Feb 15, 2022 08:48 · 216 words · 2 minute read

Docker (Engine)

  1. Follow the installation steps for Ubuntu (not the ones for Windows or WSL2!) in the Docker Documentation. The easiest installation method is probably “Install using the repository”.
  2. The sudo docker run hello-world command won’t work yet (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?). Solution: In a separate terminal session, run sudo dockerd. Then, the command will succeed and you can use Docker like you would on “normal” Linux! 🎉

Docker Compose

Most people will want to install Docker Compose, too. Docker Desktop ships with Docker Compose included - but as we did not use Docker Desktop to install Docker (Engine), we need to install Docker Compose separately.

Please note that there are now two different versions of Docker Compose. The “old” docker-compose variant (written in Python), and the new V2 docker compose variant (“Docker Compose CLI plugin”). Here, I will focus on the newer one.

To install docker compose, you need to follow the instructions on “Install Docker Compose CLI plugin”. Easiest is to follow the instructions in section “Install using the repository” (as we already have set up the repository when installing Docker before).


(via Install Docker on Windows (WSL) without Docker Desktop by Jonathan Bowman on dev.to, which is a bit too detailed in my opinion)