Install and Use Podman on Ubuntu 20.04

In this guide, we want to teach you How To Install and Use Podman on Ubuntu 20.04.

Podman is a container engine—a tool for developing, managing, and running containers and container images. Containers are standardized, self-contained software packages that hold all the elements necessary to run anywhere without the need for customization, including application code and supporting libraries. Container-based applications have revolutionized software development over the past decade, making distributed and cloud-based systems easy to deploy and maintain.

Podman is a project from Red Hat that is open source and free to download.

How To Install and Use Podman on Ubuntu 20.04

To install Podman, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 20.04.

Now Follow the steps below to complete this guide.

Steps To Install Podman on Ubuntu 20.04

By default, Podman packages aren’t available in the default Ubuntu 20.04 repository. So you need to manually add the Podman repository.

First, update and upgrade your local package index with the following command:

sudo apt update && sudo apt upgrade

Then, use the following command to add the Podman repository:

echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list

Next, run the command below to add the GPG key:

curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/Release.key" | sudo apt-key add -

Run the system update again:

sudo apt update

Finally, use the command below to install Podman:

sudo apt install podman

Verify your installation by checking its version:

podman -v
Output
podman version 3.4.2

To get full information about Podman, you can use:

podman info
Output
host:
arch: amd64
buildahVersion: 1.23.1
cgroupControllers:
 - cpuset
  - cpu
  - cpuacct
  - blkio
  - memory
  - devices
  - freezer
....

How To Use Podman on Ubuntu 20.04

Now that you have installed Podman on your server let’s see its basic usage.

Search and pull images with Podman

Just like Docker, you can use the Podman command line to search Images but from different repositories.

For example, if you want to install a Ubuntu container using Podman, then you can search what are the images available through the different repositories.

podman search ubuntu

Then, you can download and pull images with the following command:

podman pull ubuntu

List all Images with Podman

If you have downloaded multiple images and now want to see what are the available images on your system, you can list all of them using the following command:

podman images

In my case:

Output
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/ubuntu latest 2dc39ba059dc 2 days ago 80.4 MB

Create a Container with Podman

Once you have the image of the application that you want, you can create a container with it. Here we have downloaded the Ubuntu image with Podman. Now we will show how to use it to create a container using Ubuntu Image.

To do this, you can use the following command:

podman run -dit --name orca ubuntu

Note: –name is a parameter to give the container whatever friendly name you want to assign.

To access your Container command line, use the following command:

podman attach orca

You will see that your command prompt changes to your container ID:

sam@048260657f81:/#

To start your container, you can use the command below:

podman start container-id or name

To stop your container, you can use the following command:

podman stop container-id or name

For more information, you can visit the Podman Documentation page.

Conclusion

At this point, you learn to Install and Use Podman on Ubuntu 20.04.

Hope you enjoy it.

You may be interested in these articles:

How To Install KVM on Ubuntu 20.04

Install and Use 7-Zip on Ubuntu 20.04

How To Set up PostgreSQL on Ubuntu 20.04

Install and Configure Zabbix on Ubuntu 20.04

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!