Podman

WSL: Emulate Docker and docker-compose Using Podman

I'm using AlmaLinux 9 as a WSL distro, so the commands below are for AlmaLinux.

sudo dnf install podman podman-docker
sudo touch /etc/containers/nodocker

docker-compose must be installed in standalone mode.

sudo curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Enable systemctl on WSL

/etc/wsl.conf

[boot]
systemd=true

Run on PowerShell to restart the WSL VM

wsl --shutdown

Open WSL again, and enable systemctl

sudo systemctl enable --now podman.socket

Profit.

Warnings About cgroupv2 manager and systemd on WSL2

To solve this

WARN[0000] The cgroupv2 manager is set to systemd but there is no systemd user session available
WARN[0000] For using systemd, you may need to log in using a user session
WARN[0000] Alternatively, you can enable lingering with: `loginctl enable-linger 1000` (possibly as root)
WARN[0000] Falling back to --cgroup-manager=cgroupfs

You need this

~/.config/containers/containers.conf

[engine]
events_logger = "file"
cgroup_manager = "cgroupfs"