2 April 2021

Docker on ArchWSL

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

Rico Sta. Cruz @rstacruz

Update

Update (June 2022): wsl-distrod is a better alternative to genie.

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
Trying to use systemctl start on ArchWSL will result in an error.

Solution: genie-systemd

genie-systemd can be used to run systemd services like Docker. Note that Docker itself requires WSL2.

Terminal
# Download genie-systemd from this page
open https://github.com/arkane-systems/genie/releases

# Install it
pacman -U genie-systemd*.pkg.tar.zst

# Run systemctl via genie
sudo genie -c systemctl start docker
Terminal
# It should work now 🎉
docker info
# Containers: 1
# Server Version: 19.03.11-ce
# Storage driver: overlay2
# ...

About genie

genie, or genie-systemd, is a workaround to run systemd services in WSL2. It can be installed by downloading the .tar.zst package from the project’s GitHub releases page.

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:

Thanks for reading! I'm Rico Sta Cruz, I write about web development and more. Subscribe to my newsletter!