If you are in my boots, starting using podman for the first time and want it to get it working on Windows and WSL, this is for you. It's a bit of a pain to have the same "Docker Desktop" experience just with "Podman Desktop".
This guide doesn't matter for security, it just documents how you make things work.
This guide only works for ubuntu 24 in your WSL distro. Versions bellow have older podman versions which are not compatible with podman desktop.
- Remove Docker Desktop if installed
- Install Podman Desktop
- Install Podman in WSL Ubuntu
- Configuring windows to cntrol podman linux and show containers from WSL in Podman Desktop.
This guide will set all default podman connections to WSL, so every podman command finally runs in WSL, even if called from windows. The other way around would be podman-remote installed in WSL, which have many problems and i can't recommend that.
Just remove it. For basic setup, podman is a drop in replacement.
Download from https://podman.io/. Install recommended extensions. Install it on WSLv2. You dont need to create a podman machine when you only connect to your WSL instance.
When finished, it should look something like this in windows. The error is expected.

Enable remote access in Settings -> Preferences -> Extensions: Podman -> Remote

sudo apt update
sudo apt install podman podman-compose openssh-server
sudo systemctl enable ssh
sudo systemctl start sshCheck if Port 22 and PubkeyAuthentication yes is enabled in sudo nano /etc/ssh/sshd_config, restart ssh service if required.
After that, it should look something like this in WSL.

From windows (or wsl, it doesnt matter): Create a random new ssh key-pair. Create it without a passphrase.
ssh-keygen -t ed25519 -f %USERPROFILE%/wsl_podman_sshidIn WSL: Copy the wsl_podman_sshid.pub file somewhere into WSL. Example to open folder in windows explorer: \\wsl.localhost\Ubuntu\srv
Copy SSH key to authorized keys. Create ~/.ssh folder if not exist.
cat /srv/wsl_podman_sshid.pub >> ~/.ssh/authorized_keys
rm /srv/wsl_podman_sshid.pubIn WSL: Enable and start podman.socket
systemctl --user enable podman.socket
systemctl --user start podman.socket
In WSL: Verify it runs
systemctl --user status podman.socket
In WSL: Use podman info to determine the correct socket path:
podman info | grep sock
should output something like this
path: /run/user/1000/podman/podman.sock
Copy the wsl_podman_sshid file somewhere into windows, example %USERPROFILE%/wsl_podman_sshid.
You may need to modify file permissions so only you have access to n(ot everyone)
Verify if ssh connection can be established. If you have a more complicated network setup, find out your wsl ip for SSH with wsl hostname -i
# in windows
ssh -i %USERPROFILE%/wsl_podman_sshid myuser@localhostNow you are ready to add the podman connection in windows. Add it with a distinct name to the Podman system connection list:
podman system connection add wsl --identity %USERPROFILE%/wsl_podman_sshid ssh://myuser@localhost/run/user/1000/podman/podman.sock
podman system connection default wsl
Verify in windows if you can see correct podman version
podman version
Now you should be able to see the "wsl" connection in podman preferences.

Finally you can create and run containers now in WSL which will show up on podman desktop on windows.

More info here: https://podman-desktop.io/docs/podman/podman-remote
Error: unable to connect to Podman socket: server API version is too old. Client "4.0.0" server "3.4.4"
Coming from Ubuntu bellow 24. It just doesnt work.
My containers running in WSL are not accessible from windows host.
Define explicit port mapping in your commands/compose.yml by adding the ip 127.0.0.1. Example compose
services:
app:
...
ports:
#- this--->127.0.0.1:<---8080:8080
-127.0.0.1:8080:8080


