Skip to content

Instantly share code, notes, and snippets.

@rstacruz
Last active June 18, 2020 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rstacruz/51da0459740ce80092a005406dc4d74c to your computer and use it in GitHub Desktop.
Save rstacruz/51da0459740ce80092a005406dc4d74c to your computer and use it in GitHub Desktop.

Running Docker in ArchWSL

Problem: Running Docker on ArchWSL doesn't work by default. ArchWSL doesn't allow systemd services.

docker info
# ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

sudo systemctl start docker
# System has not been booted with systemd as init system (PID 1). Can't operate.
# Failed to connect to bus: Host is down

Solution: Use genie-systemd to run systemd services like Docker. Note that Docker itself requires WSL2.

# Install genie-systemd
yay -S genie-systemd

# Run it via genie
sudo genie -c systemctl start docker

# It should work now 🎉
docker info
# Containers: 1
# Server Version: 19.03.11-ce
# Storage driver: overlay2
# ...

Not running WSL2?

Here's a guide on converting an WSL1 installation to WSL2.

Other alternatives

I've found that genie works the best for my case. However, there are also other ways to get Docker and systemd working:

  • ArchWSL2 is a fork of ArchWSL with support for systemd
  • The ArchWSL wiki has some resources in its Known issues page
  • systemdctl-alt is an alternate fork of systemd which will work with WSL1 and WSL2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment