Install and Use Podman on Ubuntu 20.04

In this guide on the Orcacore website, 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 on the Initial Server Setup with Ubuntu 20.04.

Now follow the steps below to complete this guide.

1. Add Podman Repository to 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

2. Install Podman on Ubuntu 20.04

Finally, use the command below to install Podman:

sudo apt install podman -y

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
get full information about Podman

3. 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 for Images 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 images are available on your system, you can list all of them using the following command:

podman images

In my case:

List all Images with Podman

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 the 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

In conclusion, installing and using Podman on Ubuntu 20.04 is simple and provides a secure, daemonless way to manage containers. It serves as a great alternative to Docker, with familiar commands and rootless operation for better security.

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

Share your love

Stay informed and not overwhelmed, subscribe now!