Currently Available: Need a skilled Software Developer for your next project?
Categories
Docker

Goodbye Docker Desktop: running Docker natively in WSL 2

After a Windows 10 update Docker Desktop + WSL 2 stopped working:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock
WSL distro terminated abruptly … exit status 1

Hours of resets and reinstalls later, the simplest fix was to bypass Docker Desktop entirely and install the Linux engine inside the Ubuntu WSL 2 distro.

Native-WSL installation (3 commands)

# 1 – accept PPA label change (only needed if apt warns)
sudo apt-get update -o Acquire::AllowReleaseInfoChange::Label=yes

# 2 – remove any Desktop shim that blocks the script
sudo rm -f /usr/bin/docker

# 3 – install engine + CLI
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER && newgrp docker

Start the service (Ubuntu 22.04+ auto-starts it):

sudo service docker start
docker run hello-world

What you gain

Aspect Docker Desktop Native in WSL 2
Install size >1 GB ≈ 200 MB
Extra VM yes (docker-desktop) none
System tray integration yes no
Init time 15–45 s service starts with WSL
Resource overhead (idle) 400-600 MB RAM <50 MB RAM
Licensing Docker Personal/Pro Docker Engine CE (MIT)

Migration notes

  • Volumes & images now live at \\wsl$\Ubuntu\var\lib\docker.
    Export any data from docker-desktop-data before uninstalling Desktop.
  • To avoid port conflicts, run only one daemon at a time:

    • sudo service docker stop when you want to return to Desktop.
    • Restore Desktop’s socket with
      sudo ln -sf /mnt/wsl/shared-docker/docker.sock /var/run/docker.sock.
  • Docker Compose v2 is included in the install script (docker compose …).

So unless you rely on Desktop-only features (GUI dashboards, Extensions, Dev Environments), running Docker straight inside WSL 2 is the cleaner option.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Subscribe to my newsletter

Get new posts when I publish them.

I respect your privacy. Unsubscribe at any time.

Leave a Reply

Your email address will not be published. Required fields are marked *