Introduction
Podman is an open-source tool used for running and managing OCI containers. It is a free and daemonless alternative to Docker, one of the most popular container management tools.
Although Podman runs Linux containers, it is available on Windows machines through the Windows Subsystem for Linux (WSL) architecture.
In this tutorial, you will learn to run Podman on Windows.
Note: If you are looking for an affordable and performant solution for running containers, take a look at our Bare Metal Cloud general-purpose instances, which are well suited for running containerized microservices. Prices start at just $38.81/m!
Prerequisites
- A machine running Windows 10 or 11 (For other systems, see how to Install Podman on Ubuntu, Install Podman on macOS).
- Administrator privileges.
Install Linux on Windows
Installing Linux distributions on Windows requires the WSL (WSL1 or WSL2) feature. In this tutorial, we will use WSL2 because it offers superior performance compared to WSL1 and full system compatibility. WSL1 is preferred only if:
- You must store project files in the Windows file system, as it offers faster access.
- Need serial port support.
- Need to control memory usage - WSL2 captures cached pages in memory until you shut down the WSL instance, which can use a lot of memory when working with large files.
- Are using VirtualBox - certain versions experience issues with WSL2.
The prerequisite for installing WSL2 is Windows 10 (version 1903, build 18362) or newer. Older versions support WSL1 only. Follow the steps below to check your Windows version.
1. Press the Windows + R key combo to open the Run dialog box.
2. Type winver and press Enter.
A popup dialog appears and at the top of it, you will see the OS version and build.
Note: See how Podman compares to Docker.
WSL
This section covers the steps for installing WSL1 or WSL2, depending on your Windows version.
Install WSL2
If your Windows version is 1903, build 18362, or above, your system supports WSL2. Follow the steps below to install it:
1. Press the Windows key and type PowerShell. Select the Run as Administrator option in the right pane:
2. In Windows PowerShell, run the following command to install WSL2:
wsl --install
The command installs WSL2, the Virtual Machine Platform, the latest Linux kernel, and downloads Ubuntu by default. New Linux installations, installed using the wsl --install
command, are set to WSL2 by default.
Note: If running wsl --install
outputs the WSL help file, WSL is already installed. Check the WSL version on your system by running wsl -l -v
.
3. Restart the machine for the changes to take effect.
4. After reboot, the Ubuntu instance installation automatically continues, prompting you to choose a username and password.
5. After setting up the username and password, the setup completes, and you can start installing Podman on Ubuntu.
If you don't want to use Ubuntu to run Podman, the following section shows how to install other Linux distributions on Windows.
Install WSL1
For Windows builds below 18362, which don't support WSL2, follow the steps below to install WSL1:
1. Open a PowerShell instance as an administrator and run the following command:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
If you decide to upgrade from WSL1 to WSL2, follow the instructions on Microsoft's website.
Note: Use the wsl --set-version [distro name] [WSL version number]
syntax to downgrade from WSL2 to WSL1, or to update to WSL2 on previously installed Linux distributions. For example, to update Ubuntu to WSL2, run:
wsl --set-version Ubuntu-20.04 2
Install a Linux Distribution
The default Linux distribution installed with WSL2 is Ubuntu. However, if you want to run Podman on a different Linux flavor, install one from the Microsoft Store or the online repository. The Microsoft Store has the biggest number of distributions available.
Option 1: Install via the Microsoft Store
At the time this article was written, the available distributions on the Microsoft Store are:
- Ubuntu 18.04, 20.04, 22.04
- openSUSE Leap 15.2
- SUSE Linux Enterprise Server 12 SP5, SP3, and SP2
- SUSE Linux Enterprise Server 15 SP1
- Kali Linux
- Debian
- Fedora Remix for WSL
- Pengwin
- Pengwin Enterprise 7 and 8
- Alpine WSL
- Raft WSL
Search for your preferred distribution in the Microsoft Store and click Get. For example:
The installation completes automatically and prompts for a username and password.
Option 2: Install via the Command Line
1. If the Microsoft Store isn't available on your machine, open PowerShell and run the following command to see a list of available Linux distributions:
wsl -l -o
The output shows the available distributions.
2. To install a Linux distribution, use the following syntax:
wsl --install -d [Distribution Name]
For example, the following command installs Kali Linux:
wsl --install -d kali-linux
After the installation, the system prompts you to create a username and password.
Install Podman
If you decide to install Podman on the default Ubuntu installation, follow the steps outlined in our tutorial for installing Podman on Ubuntu.
However, if you decide to use a different distribution, the steps for installing Podman depend on that specific distribution.
For example, to install Podman on Kali Linux, follow the steps below:
1. Update the system repository:
sudo apt update
2. Install Podman:
sudo apt -y install podman
After the installation completes, follow our tutorial to get started with the basics of using Podman, working with images, containers, and pods.
Conclusion
This guide explained how to install a Linux distribution on Windows to run Podman using WSL. Next, read our tutorial on using Podman Compose, or get started by reading everything you need to know about Podman.