WSL with Podman on Windows
This article explains the activation of WSL2 in Windows and the installation of Podman.
Note: WSL2 is officially ready for production use:
https://learn.microsoft.com/en-us/windows/wsl/faq#can-i-use-wsl-for-production-scenarios--
Install WSL on a Recent Windows
In a priviledged PowerShell the following command must be executed:
wsl --installIf wsl is already installed, you’ll see a help text.
Install Podman
Only the Podman CLI is needed to run Containers. Podman Desktop is not needed. You can find the releases of the Podman CLI at https://github.com/containers/podman/releases.
Download the Asset of a latest Release (i.E. podman-installer-windows-amd64.exe) and start the installation process.
Once you reach this screen:
You select the Windows Linux Subsystem (WSLv2) Option and continue the installation process.
Since Podman does not run naively on Windows, the WSL-Environment for it needs to initialized first. Open a Terminal and run the following commands to initialize and start the Podman Environment:
> podman machine init
Looking up Podman Machine image at quay.io/podman/machine-os-wsl:5.5 to create VM
Getting image source signatures
Copying blob 4fdeac6595b9 done |
Copying config 44136fa355 done |
Writing manifest to image destination
4fdeac6595b9a1382f2b97088f1c6d6e4c503d1558d5472269294a3a2c0398b1
Extracting compressed file: podman-machine-default-amd64 [=====================================>--] 181.4MiB / 1Extracting compressed file: podman-machine-default-amd64: done
Importing operating system into WSL (this may take a few minutes on a new WSL install)...
Import wird ausgeführt. Dieser Vorgang kann einige Minuten dauern.
Der Vorgang wurde erfolgreich beendet.
Configuring system...
Machine init complete
To start your machine run:
podman machine start
PS C:\Users\j.saalfeld> podman machine stasrt
Error: unrecognized command `podman machine stasrt`
Try 'podman machine --help' for more information
> podman machine start
Starting machine "podman-machine-default"
This machine is currently configured in rootless mode. If your containers
require root permissions (e.g. ports < 1024), or if you run into compatibility
issues with non-podman clients, you can switch using the following command:
podman machine set --rootful
API forwarding listening on: npipe:////./pipe/docker_engine
Docker API clients default to this address. You do not need to set DOCKER_HOST.
Machine "podman-machine-default" started successfullyTo verify, that the locally installed CLI is properly connected to the now running environment, you can check the connection between the programs:
> podman system connection list
Name URI Identity Default ReadWrite
podman-machine-default ssh://user@127.0.0.1:51578/run/user/1000/podman/podman.sock C:\Users\user\.local\share\containers\podman\machine\machine true true
podman-machine-default-root ssh://root@127.0.0.1:51578/run/podman/podman.sock C:\Users\user\.local\share\containers\podman\machine\machine false trueAutostart the podman-machine-default WSL Environment
Open Task Scheduler (or Aufgabenplaner in German) via the Start-Bar
On the right side you can find the Create Task… Entry
Enter “Start Podman Machine” as Name
Enter the Configuration for “Windows 10”
Select the “Triggers” Tab
Choose At startup from the Begin the task menu
Click the OK button
Go to the Actions tab and click the New button.
Enter the
podmanas command andmachine startas argumentsAccept every upcoming prompt - you may need to re-enter your password
Verify
podman-default-machineis runningpodman machine lsReboot
Verify again, that the
podman-default-machineis runing by runningpodman machine ls
> podman machine ls
NAME VM TYPE CREATED LAST UP CPUS MEMORY DISK SIZE
podman-machine-default* wsl 11 minutes ago Currently running 6 2GiB 100GiB