How To

How To Install Podman on Ubuntu 24.04|22.04|20.04

How to install Podman on Ubuntu?. Podman (Pod Manager) is a tool used to create and maintain containers. It is part of the libpod library. The Red Hat team has been working on a set of tools for running containers without a daemon. Did you know you can’t run Docker containers without Docker Engine daemon?.

Original content from computingforgeeks.com - post 9903

[ebook product=”2″ theme=”purple”]

The following set of tools work together to power the use of Containers without an all-time running daemon process.

  • Buildah to facilitate building of OCI images
  • Skopeo for sharing/finding container images on Docker registries, the Atomic registry, private registries, local directories and local OCI-layout directories.
  • Podman for running containers without need for daemon.

Buildah’s commands replicate all of the commands that are found in a Dockerfile. Buildah containers are just created to allow content to be added back to the container image.

Podman gives you all the commands and functions required to maintain and modify OCI images, such as pulling and tagging. It also allows you to create, run, and maintain containers created from those images.

Install Podman on Ubuntu

There are two methods of instalallation:

Method 1: Install Podman from OS repositories

On Ubuntu 22.04+, you can install Podman from OS repositories.

sudo apt update && sudo apt -y install podman

Check the version of Podman package installed.

$ podman --version
podman version 4.9.3

Method 2: Using Kubic PPA repository

The podman packages are also available Kubic project repository for Ubuntu system:

Note: This doesn’t work on Ubuntu 24.04, only run on 20.04 and 22.04.

Add the repository by running the commands below.

. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -

Once the repository is added, proceed to install Podman.

sudo apt update
sudo apt -y install podman

After the installation, you can display information pertaining to the host, current storage stats, and build of podman.

$ podman  --version
podman version x.y.z

$ podman  info

Test Podman by running a container

Pull Alpine docker image.

$ podman pull alpine
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob ec99f8b99825 done   |
Copying config a606584aa9 done   |
Writing manifest to image destination
a606584aa9aa875552092ec9e1d62cb98d486f51f389609914039aabd9414687

List Downloaded images

$ podman  images
REPOSITORY                      TAG      IMAGE ID       CREATED        SIZE
docker.io/library/alpine        latest   5cb3aa00f899   3 days ago     8.09 MB
docker.io/library/hello-world   latest   fce289e99eb9   2 months ago   5.62 kB

Podman’s local repository is in /var/lib/containers

Run container with command – command options similar to docker.

$ podman  run -it  --rm docker.io/library/alpine /bin/sh
/ # apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/community/x86_64/APKINDEX.tar.gz
v3.20.1-138-gdca7b7c7495 [https://dl-cdn.alpinelinux.org/alpine/v3.20/main]
v3.20.1-139-ga1c75604690 [https://dl-cdn.alpinelinux.org/alpine/v3.20/community]
OK: 24157 distinct packages available

/ # apk add vim
(1/5) Installing vim-common (9.1.0414-r0)
(2/5) Installing xxd (9.1.0414-r0)
(3/5) Installing ncurses-terminfo-base (6.4_p20240420-r0)
(4/5) Installing libncursesw (6.4_p20240420-r0)
(5/5) Installing vim (9.1.0414-r0)
Executing busybox-1.36.1-r29.trigger
OK: 40 MiB in 19 packages
 / # exit

Show running containers.

$ podman ps
CONTAINER ID  IMAGE                            COMMAND  CREATED        STATUS            PORTS  NAMES
1eb35f1b7de8  docker.io/library/alpine:latest  /bin/sh  4 seconds ago  Up 4 seconds ago         pedantic_roentgen
ec9c5b12db46  docker.io/library/alpine:latest  /bin/sh  5 minutes ago  Up 5 minutes ago         ecstatic_wiles

Podman CLI Cheat Sheet

Check out below reference commands when using Podman.

CommandDescription
podman run <image>Run a container from an image
podman psList running containers
podman imagesList local container images
podman pull <image>Pull an image from a registry
podman build -t <tag> .Build an image from a Dockerfile
podman stop <container>Stop a running container
podman start <container>Start a stopped container
podman restart <container>Restart a running container
podman rm <container>Remove a stopped container
podman rmi <image>Remove an image
podman exec -it <container> <command>Execute a command in a running container
podman inspect <container/image>Display detailed information about a container/image
podman logs <container>View logs from a container
podman network lsList Podman networks
podman volume lsList Podman volumes
podman system pruneRemove all stopped containers, networks, and volumes
podman versionDisplay Podman version
podman infoDisplay Podman system information
podman helpDisplay Podman command help

For more on usage of Podman, check:

To setup private registry, checkout:

Conclusion

Podman seems to be a replacement for Docker and other container management tools which require a daemon to work. It is still fresh and in early development stages to tell a lot. In RHEL 8, the officially supported tools for managing Docker containers are Podman and Buildah.

Related guides:

Related Articles

Containers How To Install Podman in Amazon Linux 2023 AlmaLinux Install Docker and Compose on Rocky 8 or AlmaLinux 8 Asterisk Install RTPProxy from Source on Ubuntu 24.04 / 22.04 Virtualization How To Install KVM Hypervisor on Ubuntu 22.04|20.04

2 thoughts on “How To Install Podman on Ubuntu 24.04|22.04|20.04”

  1. Very good information! I was able to install podman on my Ubuntu 20.04 system following these instructions. There is just one minor type under “Show running containers.”, the command is “podman ps” not “podman ls”.

    Thanks!

    Reply

Leave a Comment

Press ESC to close