Podman on Windows: A Lightweight Docker Alternative
Docker on Windows is known for being resource-intensive, requiring a background daemon to run containers. If you’re looking for a more efficient solution, Podman offers a lightweight, secure, and daemonless alternative with full Docker compatibility.
How Podman Works on Windows
Since Windows can’t natively run Linux containers, Podman uses a lightweight virtual machine (VM) to provide a Linux environment for containers.
Key Technologies Behind Podman on Windows:
- QEMU & Lima for VM management
- Fedora CoreOS as the default OS inside the Podman VM
- KVM (Kernel-based Virtual Machine) for efficient container execution
- Rootless containers via user namespaces for enhanced security
- Full compatibility with Docker’s OCI image format
Setting Up Podman and Running Containers
1. Initialize the Podman Machine
First, set up the lightweight VM:
podman machine init
This creates a Fedora CoreOS-based VM for container execution.
It will auto install WSL and Fedora if not already present
2. Start the Podman Machine
Launch the VM:
podman machine start
The QEMU-based Linux environment is now ready.
3. Pull a Container Image
Download an image (e.g., Nginx):
podman pull nginx
4. Run a Container
Start a container just like with Docker:
podman run -d -p 8080:80 nginx
Nginx is now running with port 8080 mapped to the container’s port 80.
Running Selenium Grid with Podman
Podman can easily handle Selenium Grid for automated testing.
1. Pull the Selenium Image
podman pull selenium/standalone-chrome
2. Start Selenium Grid
podman run -d -p 4444:4444 --shm-size=2g selenium/standalone-chrome
Selenium Grid is now accessible at http://localhost:4444.
Configure Podman with Docker Alias (PowerShell)
To make Podman even easier to use, set it in your system PATH and alias docker
commands to Podman:(Run with admin permission)
$podmanPath = Join-Path $env:USERPROFILE ".m2\selenium-utils\bin\podman.exe"
[System.Environment]::SetEnvironmentVariable("Path", $env:Path + ";$podmanPath", [System.EnvironmentVariableTarget]::Machine)
"Set-Alias -Name docker -Value podman" | Out-File -Append -Encoding utf8 $PROFILE
. $PROFILE
Now you can use docker
commands that actually run Podman.
Example: Running Selenium Grid with Docker Alias
docker pull selenium/standalone-chrome
docker run -d -p 4444:4444 --name selenium-grid selenium/standalone-chrome
Verify at http://localhost:4444 – it just works.
Bonus: Selenium Utils Library
For an even smoother experience, check out my Selenium Utils library, which simplifies Podman setup and includes Selenium Grid examples.
Reference :
Leave a Reply