In this guide, you will learn to Install and Use Podman Container on Ubuntu 22.04.
Podman is an open-source, Linux-native tool designed to develop, manage, and run containers and pods under the Open Container Initiative (OCI) standards. Presented as a user-friendly container orchestrator developed by Red Hat, Podman is the default container engine in RedHat 8 and CentOS 8.
It is one of a set of command-line tools designed to handle different tasks of the containerization process, that can work as a modular framework.
Steps To Install and Use Podman on Ubuntu 22.04
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.
Set up Podman on Ubuntu 20.04
By default, Podman packages aren’t available in the default Ubuntu 22.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
Add Podman Repository
Then, use the following command to add the Podman repository:
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
Add Podman GPG Key
Next, run the command below to add the GPG key:
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.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 -y
Verify your installation by checking its version:
podman version 3.4.4
To get full information about Podman, you can use:
How To Use Podman on Ubuntu 22.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:
In my case:
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/ubuntu latest 6b7dfa7e8fdb 4 weeks ago 80.3 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:
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.
At this point, you have learned to Install and Use Podman Container on Ubuntu 22.04.
Hope you enjoy it.
You may be interested in these articles on the Orcacore website: