Podman remote container host setup for Windows
Prerequisites:
- PowerShell v7.2 or above
- Vagrant on Windows
- VMware Workstation Pro or VMWare Workstation Player
- Vagrant vmware Utility
- Podman Windows Client
Vagrant, VMWare Workstation Pro/Player, and Podman Windows Client can be installed from winget (Windows Package Manager Client) command line tool on Windows 10 & 11.
winget install --id Hashicorp.Vagrant
winget install --id RedHat.Podman
Notes:
- You need to re-open command line window to be able to use Podman cli program
Setup:
- Git clone the main branch of the repository.
- Inside the git clone folder, run
vagrant up
to create the Vagrant environment in PowerShell: - Generate an ed25519 SSH keypair files on Windows host, if you’ve never created before:
ssh-keygen -t ed25519
- Copy the generated public key into the Vagrant Virtual Machine by following command in PowerShell:
type $env:USERPROFILE\.ssh\id_ed25519.pub | vagrant ssh -c "cat >> ~/.ssh/authorized_keys"
- Run
vagrant ssh-config
to get the SSH host binding port of the Vagrant VM: -
Run following command to get the remote socket path information of Podman in the Vagrant VM:
vagrant ssh -c 'podman --remote info --format={{".Host.RemoteSocket.Path"}}'
The above example shows the socket path is /tmp/podman-run-1000/podman/podman.sock. - Run following command to add a remote VM connection settings on Host Windows machine, this example is using Port 2222, remote socket path is /tmp/podman-run-1000/podman/podman.sock, and the connection name is vg_podman:
podman --remote system connection add vg_podman --identity $env:USERPROFILE\.ssh\id_ed25519 ssh://vagrant@127.0.0.1:2222/tmp/podman-run-1000/podman/podman.sock
Then use
podman system connection list
to verify the connection setting.
Notes
- After finish above steps, you can use
podman info
on Windows to verify remote container host connection status. - If you need to recreate the VM, Invoke
vagrant destroy -f
in the git clone folder, thenvagrant up
again. Only needs do above step 4. to copy the ed25519 public key from Windows into new VM. - The VM will automatically suspend when Windows system shutdown or reboot, it’s state can be known via invoke
vagrant status
in the git clone folder, you need to resume the VM by runningvagrant up
to be able to use Podman host again.