Skip to content

Instantly share code, notes, and snippets.

@AndhikaWB
Created October 30, 2025 06:57
Show Gist options
  • Select an option

  • Save AndhikaWB/4170ef96a7e9023292173c6095aefe64 to your computer and use it in GitHub Desktop.

Select an option

Save AndhikaWB/4170ef96a7e9023292173c6095aefe64 to your computer and use it in GitHub Desktop.
Use Docker (without Docker Desktop) from Arch Linux WSL

Why?

Docker Desktop on Windows is bloated, it requires running Docker Desktop all the time. Not to mention all the AI stuff that is being pushed to it. Running Docker on Linux (WSL) directly is more efficient as Docker Desktop uses a Linux VM too behind the scene.

Setup

Install Arch Linux WSL distro. You will enter Arch Linux automatically when it's done downloading.

wsl --install archlinux

Arch Linux in WSL uses the root account by default. This is unsafe, so we need to install sudo and create our account manually.

pacman -Sy sudo
# Just in case the group doesn't exist
groupadd sudo

Now edit /etc/sudoers and uncomment wheel ALL=(ALL) ALL and %sudo ALL=(ALL) ALL.

pacman -Sy nano
nano /etc/sudoers

Add a new user account.

useradd -m -G wheel,sudo -s /bin/bash <username>
# Set the password for the user account
passwd <username>
# Set password for root too (optional but recommended)
passwd root

Install Docker and Docker Compose.

pacman -Sy docker docker-compose
# Add our user to the Docker group
usermod -aG docker <username>

If you want to use CUDA inside the Docker container, install Nvidia toolkit too. Later, when running the container, you need to add the parameter --gpus all or --runtime=nvidia.

pacman -Sy nvidia-container-toolkit
# Optional, still work in my case without setting this
nvidia-ctk runtime configure --runtime=docker

Now exit from WSL to change the default user.

exit
wsl --terminate archlinux
wsl --manage archlinux --set-default-user <username>
# Enter WSL again
wsl -d archlinux

Activate the Docker socket (per Arch wiki).

# Prevent docker socket from waiting this service
# This service doesn't work correctly in WSL
sudo systemctl disable --now systemd-networkd-wait-online.service
# Enable the actual docker socket
sudo systemctl enable --now docker.socket

# Check the status
systemctl status docker.socket
docker info

It's done! If you need to execute docker directly from Windows, you just need to set an alias on your shell. It's much safer than exposing the Docker socket.

alias docker="wsl -d archlinux docker"
alias docker-compose="wsl -d archlinux docker-compose"

For monitoring Docker easily, you can install lazydocker (CLI) or podman-desktop (GUI). I personally liked lazydocker more because it has no dependency. For other alternatives, see the Docker Arch wiki.

sudo pacman -Sy lazydocker
# To run lazydocker
lazydocker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment