Skip to Content
Installation

Install Podman

Run containers with almost the same commands as Docker, without a background service and without administrator rights.

Last reviewed:

What Podman is

A program that runs containers, meaning pre-packaged programs that start the same way on every computer. The same thing Docker does, and with almost the same commands. If you type podman instead of docker, most of what you have already learned works.

Two differences are worth knowing about. Podman runs without a background service that has to be running, which means fewer moving parts. And Podman runs containers as your regular user instead of as the system administrator, which means that a program that breaks inside the container does not have access to the whole computer.

Does a company need to switch from Docker? No. But if you are going to choose one anyway, and especially if you run Linux, Podman is a perfectly good choice with no licensing issues.

Linux Mint

This is the easiest option. Open Terminal and run:

sudo apt-get update
sudo apt-get install podman

That is the whole installation. No service to start, no reboot. Check with:

podman run hello-world

If you get a greeting message, everything works. The first time, Podman often asks which image registry it should pull from, and you select docker.io in the list. If you instead get an error message saying the name could not be resolved, type docker.io/library/hello-world in full so Podman does not have to guess.

Windows

On Windows, Podman runs the containers inside WSL2, which is Windows' own built-in Linux. You do not need to understand this in detail, but it explains why the installation has an extra step.

First install WSL2 if it is not already there. Open PowerShell as administrator, run wsl --install and restart the computer.

Then download Podman Desktop from podman-desktop.io and run the installer. It gives you both the graphical interface and the podman command in PowerShell.

Before you can run anything, you need to start the Linux machine that the containers live in:

podman machine init
podman machine start

The first command is run once. The second is run every time you restart the computer, unless you have set the machine to start automatically. Then check with podman info.

Three things to do first

  1. Try that what you already know works. Run podman run -d -p 8080:80 nginx and surf to http://localhost:8080. It is the same command as with Docker, just a different first word, and seeing it work removes a lot of worry.
  2. Run podman ps and then podman stop with the name you get. Being able to see what is running and shut it down is half of everyday life with containers, and the two commands go further than you think.
  3. Try compose files if you have any from before. The package podman-compose is installed with sudo apt-get install podman-compose on Mint, and reads the same files as Docker Compose. Support exists, but is not one hundred percent, so expect that some file needs an adjustment.

The most common trap

Ports below 1024. Because Podman runs as your regular user, and not as administrator, it is not allowed to open the low ports. The command podman run -p 80:80 nginx therefore gives a denial on Linux, while exactly the same command with Docker works. It looks like Podman is broken. In reality it is the security you chose.

The solution is to use a high port externally, that is -p 8080:80, and that is enough in almost every situation while you develop. If the service is to be on the real port 80 externally, you solve it on the server with a redirect, not by running all of Podman as administrator.

The other half: containers that you started as your user do not show up if you then run sudo podman ps. They are two separate worlds with their own lists. Do not mix sudo into this, and you avoid wondering where your containers went.

Cart

Loading