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
# ...
Here's a guide on converting an WSL1 installation to WSL2.
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