28 C
Jaipur
Monday, April 12, 2021

How to Install Podman on Ubuntu 20.04

Must read

Podman (POD Manager) is a tool to manage OCI containers and pods. It is an open-source project which can be used in most Linux distributions that use daemonless container engine.

Podman and docker use two different architectures. Docker depends on daemon for all its functionality where Podman directly interacts using runC. Podman has more functionalities in the Kubernetes environment. Commands are very similar to Docker commands and can work on root and rootless mode. Much different from other container runtime podman has the ability to deploy pods.

In this article, we are going to explain how to install Podman on Ubuntu 20.04 and learn its basic usage to manage images and containers.

Prerequisites

  1. Fresh Installed Ubuntu server 20.04
  2. Proper Internet connection to install packages
  3. Sudo privileged non-root user

Install Podman on Ubuntu 20.04

Installation of Podman on Ubuntu 20.04 is a simple and straightforward process. To install Podman on Ubuntu, follow the steps:

Update Ubuntu repository index to latest using following command:

$ sudo apt update -y

Access your ubuntu server and run following command to source release version.

$ source /etc/os-release

Execute following command to create apt source file

$ sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"

Add the apt key using following command:

s wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add -

Now update Ubuntu repository using following command to enable Podman repository.

$ sudo apt update -qq

Finally use following command to install Podman

$ sudo apt-get -qq --yes install podman

Podman Package is available in the official repositories for ubuntu 20.10 and newer. To install Podman on Ubuntu 20.10 and newer, run the following command:

Update Ubuntu repositories to latest index using following command:

$ sudo apt update

To install Podman package run the following command:

$ sudo apt-get -y install podman

It is recommended to use Buildah, Podman and Skopeo ONLY from EITHER the kubic repo OR the official Ubuntu repos. Mixing and matching may create unpredictable situations including installation failure.

Verify Podman Installation

After completing installation, run the following command to check Podman version.

$ sudo podman --version

You will get following output on your terminal.

Checking Podman version

The output shows that , installed podman version is 3.0.0.

To check Podman configuration and version information run the following command:

$ sudo podman info

You will get output similar as:

Podman configuration and version information

Working with OCI Registries

Podman supports multiple container registries from where you can pull container images. When you specify the container name that does not contain a registry, Podman looks for a list of registries from the registry configuration file (/etc/containers/registries.conf) to pull the container image from.

You can add different available container image registries such as docker.io and registry.redhat.com (you can add other registries too) in the configuration file.

Edit /etc/containers/registries.conf file with any text editor as:

$ sudo nano /etc/containers/registries.conf

Paste the following contents:

# This is a system-wide configuration file used to
# keep track of registries for various container backends.
# It adheres to TOML format and does not support recursive
#  lists of registries.
# The default location for this configuration file is
# /etc/containers/registries.conf.
# The only valid categories are: 'registries.search', 'registries.insecure', 
# and 'registries.block'.
[registries.search]
registries = ['docker.io', 'quay.io', 'registry.access.redhat.com']
# If you need to access insecure registries, add the registry's fully-qualified name.
# An insecure registry is one that does not have a valid SSL certificate or only does HTTP.
[registries.insecure]
registries = [ ]
# If you need to block pull access from a registry, uncomment the section below
# and add the registries fully-qualified name.
# Docker only
[registries.block]
registries = [ ]

Save and exit the file.

Working with Podman Images

You can search for the Podman images in the registries you have specified as:

$ podman search ubuntu-20.04

You will get the output in your terminal as:

Searching Podman images

To pull Podman images you can run the command sudo podman pull <image-name> . In this example I have pulled latest version of nginx image as:

$ sudo podman pull nginx

The command generates output as:

Pulling Podman image

The output shows that latest version of nginx is being pulled from docker registry.

To list the downloaded Podman images, run the following command:

$ sudo podman images

The output looks like:

Listing Podman Images

To list the Podman container running in the system, run the command:

$ sudo podman ps -a

You can see the output in your terminal as:

Listing podman containers

Conclusion

In this article, you have learned about the installation of Podman on Ubuntu 20.04. Also, you have learned how to use different container image registries in the Podman configuration and pull images from the registry. You have got a basic idea about different Podman commands to pull images, list downloaded images and containers.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article