Install Podman on Ubuntu

By
Bosko Marijan
Published:
January 29, 2025

Introduction

Podman is a daemonless container engine designed as a drop-in replacement for Docker. Unlike Docker, Podman does not rely on a separate daemon process, making it more lightweight and potentially more secure.

This tutorial will how you how to install and use Podman on Ubuntu.

Install Podman on Ubuntu.

Prerequisites

  • A system running Ubuntu (this guide was made using Ubuntu 24.04).
  • Command-line access.
  • Administrative privileges on the system.

Note: Learn how to set up Podman on other operating systems by reading how to install Podman on macOS and how to run Podman on Windows.

Installing Podman on Ubuntu

The podman package is available in the official Ubuntu repositories. Follow the steps below to install Podman on Ubuntu:

1. Open the terminal and update the repository information:

sudo apt update

2. Install Podman with the following command:

sudo apt install podman -y

3. Verify the installation by checking the program version:

podman --version
Checking Podman program version.

Using Podman on Ubuntu

Use Podman to pull images from repositories such as Docker Hub (docker.io) and Quay (quay.io) and run containers. This section shows different examples of using Podman on Ubuntu.

Note: Podman is an alternative to Docker. Read our Podman vs. Docker article to learn the differences between these container management tools.

Search for Images

Search for images in the available repositories using the following syntax:

podman search [repository]/[keyword]

For example, to search for MySQL images on Docker Hub, run:

podman search docker.io/mysql

The output shows a list of available images and their descriptions.

Searching for images using Podman.

Download Images

Download an image from a remote repository using the following syntax:

podman pull [repository]/[image]

For example, the following command pulls the mysql image from the Docker Hub's library repository:

podman pull docker.io/library/mysql
Downloading an image using podman.

Note: Dive deeper into the Podman syntax and understand how Podman works with our Podman basics tutorial.

List Downloaded Images

List all downloaded images by running the following command:

podman images

The output lists all images currently on the system and provides image details, including:

  • Repository. The origin repository.
  • Tag. Any tags associated with the image.
  • Image ID. A unique number for each image.
  • Created. The image creation date.
  • Size. Image size on disk.
Listing existing images on Ubuntu.

Create Containers

Use the following syntax to create a new container from the downloaded image:

podman run [options] [image]

For example, to create a container from the downloaded mysql image, run the following command:

podman  run -dit mysql
  • The -d option forces the detached mode, which tells Podman to run the container in the background.
  • The -i option runs the container in the interactive mode, keeping standard input open even when the detached mode is active.
  • The -t option tells Podman to allocate a pseudo-TTY and attach it to the container's stdin. This option prevents stdout redirection.

If successful, the operation outputs the container ID.

Creating a container from a downloaded image.

List Available Containers

Use the following command to list all the containers on your machine, regardless of their state (running or stopped):

podman ps -a

The output includes the following information:

  • Container ID. Each container's unique number (short form).
  • Image. The image the container is based on.
  • Command. The command for launching the container.
  • Created. The time elapsed since the container was created.
  • Status.ย Container uptime or downtime.
  • Ports.ย Includes any forwarded ports.
  • Names. A unique name assigned by Podman for each container.
Listing all available containers on Ubuntu.

Note: Enter the podman ps command without the -a flag to show only the running containers.

To show a single container, specify its Container ID using the -f option:

podman ps -f "id=[container_id]"

To filter by name, use the following syntax:

podman ps -f "name=[container_name]"

Create Image from Container

Create a new image from a running container and upload it to the repository by using the command below:

podman commit --author "[author]" 6f3aeb480f89

The --author flag sets the image author. Once the image is created, its ID is displayed in the output.

Output of creating an image from container by setting the image author using --author flag.

Start or Stop Container

Start an already existing container using the following syntax:

podman start [container_name_or_id]

To stop a running container, type:

podman stop [container_name_or_id]

Stop or start the latest container by specifying the --latest flag instead of the container ID or name. For example:

podman stop --latest

Remove Container

Remove an existing stopped container with the command below:

podman rm [container_name_or_id]

If the deletion is successful, the output echoes the deleted container's ID.

Conclusion

This tutorial showed how to install Podman on Ubuntu and demonstrated some basic use cases. Podman is a great daemonless alternative for Docker and other container management utilities that require a daemon to work.

If you want to test other container management tools, install Docker on Ubuntu and learn the basic commands.

Was this article helpful?
YesNo