Run Native Linux Docker on Windows WSL with Systemd: A Step‑by‑Step Guide
This guide explains how to enable systemd in WSL, configure /etc/wsl.conf, and install the Linux‑native Docker engine on Ubuntu within Windows, highlighting the benefits for container‑based development and Microsoft’s effort to improve cross‑platform tooling.
Background and Systemd Support in WSL
On September 21, 2022, Microsoft added systemd support to Windows Subsystem for Linux (WSL), initially for Windows 11. Systemd is the init system used by most mainstream Linux distributions, and its presence allows WSL to run services that depend on it, such as snap, LXD, and Docker, with proper PID 1 handling and clean shutdown.
Enabling Systemd
If systemd is not already active, edit the /etc/wsl.conf file and add the following section, then restart WSL (requires WSL version 0.67.6 or newer):
[boot]
systemd=trueInstalling Native Docker on Ubuntu in WSL
The installation consists of four main steps:
Update the package index and install prerequisite packages.
apt update && apt -y install --no-install-recommends apt-transport-https ca-certificates curl gnupg2Add Docker’s official APT repository.
echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu jammy stable" | tee /etc/apt/sources.list.d/docker.listImport Docker’s GPG key to verify packages.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | tee /etc/apt/trusted.gpg.d/docker.ascRefresh the package list again and install Docker Engine, CLI, containerd, and related plugins.
apt update && apt -y install --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginWhy Native Docker Matters
Running Docker directly inside WSL eliminates the need for heavyweight solutions like Docker Desktop, offering a lighter, faster, and more flexible development environment that behaves like a true Linux system. This improves productivity for developers who rely on containerization while staying on a Windows workstation.
Impact on Microsoft’s Development Ecosystem
The systemd addition showcases Microsoft’s commitment to enhancing WSL’s compatibility with the broader Linux ecosystem, thereby expanding tooling options and streamlining cross‑platform workflows for the developer community.
Conclusion
With systemd enabled, installing the Linux‑native Docker engine on WSL becomes straightforward, delivering near‑native Linux experience on Windows and fostering smoother, more efficient container‑based development.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ops Development & AI Practice
DevSecOps engineer sharing experiences and insights on AI, Web3, and Claude code development. Aims to help solve technical challenges, improve development efficiency, and grow through community interaction. Feel free to comment and discuss.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
