Steps to Install & Configure Podman on Ubuntu 20.04 LTS

Podman is a free & open source tool. It is used for developing, managing, and running containers and images. It is slimier to Docker. Using Podman, we can easily pull or push the images. It is a simple & easy-to use tool. We can easily create & run the images. The different between docker & podman are: Docker needs the Docker Engine daemon whereas Podman doesn’t require a daemon to run containers.

Prerequisite:

  • Ubuntu system with sudo privileges.

There are some steps to Install & Configure Podman on Ubuntu:

Step 1: Update the System.

apt-get update

Step 2: Install required packages.

apt-get install curl wget gnupg2

  • Run the following command to source Ubuntu release.

source /etc/os-release

  • Add the Repository.

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 GPG key.

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

  • Update the packages.

apt-get update -qq

Step 3: Install Podman on Ubuntu.

apt-get -qq --yes install podman

  • Here is the command output.

  • Check Podman version.

podman --version

  • Check Podman configuration.

podman info

  • Here is the command output.

  • To list the podman options.

podman --help

  • Here is the command output.

Step 4: Configure to add the OCI Registry.

  • Open the following file.

vim /etc/containers/registries.conf

  • Comment the given below line & Add the following new lines:

# # An array of host[:port] registries to try when pulling an unqualified image, in order.
#unqualified-search-registries = ["docker.io", "quay.io"]
##
###
[registries.search]
registries = ['docker.io', 'quay.io', 'registry.access.redhat.com']
####
####
[registries.insecure]
registries = [ ]
###
####
[registries.block]
registries = [ ]

Step 5: Now Search the images in the registries using podman.

podman search ubuntu-20.04

  • Here is the command output.

Step 6: To pull/download the nginx image.

podman pull nginx

  • Here is the command output.

  • Hit Enter.

  • List the downloaded image.

podman images

  • Here is the command output.

  • Create a Container.

podman run -dit -p 80:80 nginx

  • Check the running container.

podman ps

  • Here is the command output.

  • To create a new image using existing container.

Syntax:

podman commit --author "Example" container-id image-name

Example:

podman commit --author "Example" 3a267ce54556 docker.io/library/new-nginx

  • Here is the command output.

  • Check images.

podman images

  • Here is the command output.

Step 7: Stop the container.

podman stop container-id

  • Stop and start the latest container.

podman stop --latest
podman start --latest

Step 8: Open the Running Nginx image using URL.

http://server-ip

  • Here is the command output.

Leave a Reply

Your email address will not be published.