Accessing Podman from another WSL distribution
In previous post I talked about how to install and run Podman WSL.
Even though I am going to discuses accessing Podman Machine from another WSL distributions (i.e. Ubuntu), you can use SSH connection to access Podman Machine from any machine that can access SSH running in Podman Machine.
Note: You can only mount volumes available in podman-machine. You can access Windows file system using Unixy (i.e. /mnt/c/Users/User/myfolder) style paths.
Unix Socket
Start Ubuntu in WSL
wsl -d UbuntuInstall
podman-remote, optionally installpodman-composesudo apt-get update sudo apt-get install -y podman-remote podman-composeAdd
podman-machine-defaultas remote connectionpodman system connection add --default podman-machine-default-user unix:///mnt/wsl/podman-sockets/podman-machine-default/podman-user.sockTroubleshoot: Make sure
$USERis part of group that owns/mnt/wsl/podman-sockets/podman-machine-default/podman-user.sockls -Al /mnt/wsl/podman-sockets/podman-machine-default/podman-user.sock sudo usermod --append --groups <group> $USERTest connection
podman-remote versionNote: If successful, the output should have a
clientsection and aserversectionOptional, create
aliasforpodmananddockerin~/.bash_aliasesalias podman=podman-remote alias docker=podman-remote
SSH Connection
Start Ubuntu in WSL
wsl -d UbuntuInstall
podman-remote, optionally installpodman-composesudo apt-get update sudo apt-get install -y podman-remote podman-composeGenerate a local
ed25519keyssh-keygen -t ed25519 -f ~/.ssh/podmanCopy the public key to Podman machine
Connect to Podman machine (From Windows Terminal, not WSL)
podman machine ssh podman-machine-defaultNote: You can list all the Podman machines with
podman machine lsCopy public key to
~/.ssh/authorized_keysTip: You need to add the content of
~/.ssh/podman(from WSL distro, i.e. Ubuntu) to~/.ssh/authorized_keysinpodman-machine-default.
In WSL distro (i.e. Ubuntu), add
podman-machine-defaultas remote connectionpodman system connection add --default podman-machine-default-user --identity ~/.ssh/podman ssh://user@127.0.0.1:51405/run/user/1000/podman/podman.sockTest connection
podman-remote versionNote: If successful, the output should have a
clientsection and aserversectionOptional, create
aliasforpodmananddockerin~/.bash_aliasesalias podman=podman-remote alias docker=podman-remote