HeadlinesBriefing favicon HeadlinesBriefing.com

Running Podman on Windows with WSL Guide

DEV Community •
×

Developers seeking a Docker alternative on Windows can now run Podman through WSL using a specific setup. The method involves Podman Desktop creating a dedicated WSL VM (the Podman Machine) and connecting to it from your standard WSL distro via the remote client. This provides a native Windows GUI and CLI access from within WSL.

The core setup requires installing Podman Desktop on Windows, which sets up the Podman Machine. Inside your WSL distribution (like Ubuntu), you install the Podman remote client binary. Connection is established using `podman system connection` to the socket at `/mnt/wsl/podman-sockets/`, typically choosing the rootful socket for reliability. You may need to adjust group permissions for your WSL user to communicate with the socket.

The primary challenge is volume mounting. Since the container runs in the Podman Machine's filesystem, paths from your regular WSL distro aren't automatically accessible. Reliable workarounds include using Windows paths via `/mnt/c/`, creating named volumes, or copying files directly. A more complex bind-mount workaround using `/mnt/wsl/` exists for mounting WSL-specific paths. Performance can suffer with Windows filesystem mounts.

For daily use, keep Podman Desktop running to maintain the socket connection. Using aliases like `alias docker=podman` eases the transition from Docker. Remember that container images and volumes reside in the Podman Machine, persisting across restarts but managed separately from your WSL distro. This setup offers a flexible container environment but requires understanding the filesystem boundaries.