How To Install Podman On Ubuntu 20.04 LTS

In this short tutorial, we will learn how to install Podman on Ubuntu 20.04 LTS oeprating system.

Introduction

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

Podman Installation On Ubuntu 20.04 Linux Operating System

Podman Installation in this tutorial will be consist of several as steps as shown below :

  1. Update Ubuntu Repository
  2. Add the Podman repository
  3. Install Podman On Ubuntu 20.04
  4. Verify the Podman Installation

The details of installation will be detail discussed below.

1. Update Ubuntu Repository

In this stage we will update our Ubuntu repository, by updating repository we will not only install the latest available security updates but also rebuild the repository cache. For this purpose we will submit the command line :

$ sudo apt update

2. Add Podman Repository

Since podman is not available on default Ubuntu 20.04 repository, we need to add the podman repository manually. But for Ubuntu 20.10 or newer the Podman has been included as standard repository. We will ddd Kubic project repository to our Ubuntu 20.04, we will do following command line :

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"
$ wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add -

Output :

rapik@worker2:~$ 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"
[sudo] password for rapik: 
rapik@worker2:~$ wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add -
2021-10-27 20:49:16 URL:https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/Release.key [1093/1093] -> "-" [1]
OK

3. Install Podman On Ubuntu 20.04

Once the repository is added, we will install Podman by submitting command line :

$ sudo apt update
$ sudo apt-get install podman

Output :

rapik@worker2:~$ sudo apt update
rapik@worker2:~$ sudo apt-get install podman
Selecting previously unselected package libfuse3-3:amd64.
(Reading database ... 142628 files and directories currently installed.)
Preparing to unpack .../libfuse3-3_3.9.0-2_amd64.deb ...
Unpacking libfuse3-3:amd64 (3.9.0-2) ...
dpkg: fuse: dependency problems, but removing anyway as you requested:
 xdg-desktop-portal depends on fuse; however:
  Package fuse is to be removed.
 open-vm-tools-desktop depends on fuse.
 ntfs-3g depends on fuse.
 gvfs-fuse depends on fuse.

(Reading database ... 142636 files and directories currently installed.)
Removing fuse (2.9.9-3) ...
update-initramfs: deferring update (trigger activated)
Selecting previously unselected package fuse3.
(Reading database ... 142626 files and directories currently installed.)
Preparing to unpack .../00-fuse3_3.9.0-2_amd64.deb ...
Unpacking fuse3 (3.9.0-2) ...
Selecting previously unselected package catatonit.
Preparing to unpack .../01-catatonit_0.1.5~1_amd64.deb ...
Unpacking catatonit (0.1.5~1) ...
Selecting previously unselected package conmon.
Preparing to unpack .../02-conmon_100%3a2.0.30-2_amd64.deb ...
Unpacking conmon (100:2.0.30-2) ...
Selecting previously unselected package containers-common.
Preparing to unpack .../03-containers-common_100%3a1-21_all.deb ...
Unpacking containers-common (100:1-21) ...
Selecting previously unselected package libnet1:amd64.
Preparing to unpack .../04-libnet1_1.1.6+dfsg-3.1build1_amd64.deb ...
Unpacking libnet1:amd64 (1.1.6+dfsg-3.1build1) ...
Selecting previously unselected package libprotobuf-c1:amd64.
Preparing to unpack .../05-libprotobuf-c1_1.3.3-1_amd64.deb ...
Unpacking libprotobuf-c1:amd64 (1.3.3-1) ...
Selecting previously unselected package criu.
Preparing to unpack .../06-criu_3.16.1-1_amd64.deb ...
Unpacking criu (3.16.1-1) ...
Selecting previously unselected package crun.
Preparing to unpack .../07-crun_100%3a1.2-2_amd64.deb ...
Unpacking crun (100:1.2-2) ...
Selecting previously unselected package fuse-overlayfs.
Preparing to unpack .../08-fuse-overlayfs_100%3a1.5.0-1_amd64.deb ...
Unpacking fuse-overlayfs (100:1.5.0-1) ...
Selecting previously unselected package podman-plugins.
Preparing to unpack .../09-podman-plugins_100%3a1.2.0-1_amd64.deb ...
Unpacking podman-plugins (100:1.2.0-1) ...
Selecting previously unselected package podman-machine-cni.
Preparing to unpack .../10-podman-machine-cni_100%3a0.0.0-1_amd64.deb ...
Unpacking podman-machine-cni (100:0.0.0-1) ...
Selecting previously unselected package podman.
Preparing to unpack .../11-podman_100%3a3.3.1-1_amd64.deb ...
Unpacking podman (100:3.3.1-1) ...
Selecting previously unselected package slirp4netns.
Preparing to unpack .../12-slirp4netns_100%3a1.1.8-3_amd64.deb ...
Unpacking slirp4netns (100:1.1.8-3) ...
Selecting previously unselected package uidmap.
Preparing to unpack .../13-uidmap_1%3a4.8.1-1ubuntu5.20.04.1_amd64.deb ...
Unpacking uidmap (1:4.8.1-1ubuntu5.20.04.1) ...
Selecting previously unselected package containernetworking-plugins.
Preparing to unpack .../14-containernetworking-plugins_100%3a1.0.0-1_amd64.deb ...
Unpacking containernetworking-plugins (100:1.0.0-1) ...
Setting up slirp4netns (100:1.1.8-3) ...
Setting up uidmap (1:4.8.1-1ubuntu5.20.04.1) ...
Setting up libnet1:amd64 (1.1.6+dfsg-3.1build1) ...
Setting up libprotobuf-c1:amd64 (1.3.3-1) ...
Setting up podman-machine-cni (100:0.0.0-1) ...
Setting up conmon (100:2.0.30-2) ...
Setting up containernetworking-plugins (100:1.0.0-1) ...
Setting up catatonit (0.1.5~1) ...
Setting up containers-common (100:1-21) ...
Setting up podman-plugins (100:1.2.0-1) ...
Setting up libfuse3-3:amd64 (3.9.0-2) ...
Setting up criu (3.16.1-1) ...
Setting up crun (100:1.2-2) ...
Setting up podman (100:3.3.1-1) ...
Setting up fuse3 (3.9.0-2) ...
Installing new version of config file /etc/fuse.conf ...
update-initramfs: deferring update (trigger activated)
Setting up fuse-overlayfs (100:1.5.0-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for initramfs-tools (0.136ubuntu6) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-26-generic

4. Verify Podman Installation

Until this step, the Podman installation is completed done. Then we will verify it by querying its version and and other information. We will use following command line :

$ sudo podman --version
$ sudo podman info

Output :

rapik@worker2:~$ sudo podman --version
podman version 3.3.1
rapik@worker2:~$ sudo podman info
host:
  arch: amd64
  buildahVersion: 1.22.3
  cgroupControllers:
  - cpuset
  - cpu
  - cpuacct
  - blkio
  - memory
  - devices
  - freezer
  - net_cls
  - perf_event
  - net_prio
  - hugetlb
  - pids
  - rdma
  cgroupManager: systemd
  cgroupVersion: v1
  conmon:
    package: 'conmon: /usr/libexec/podman/conmon'
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.30, commit: '
  cpus: 2
  distribution:
    distribution: ubuntu
    version: "20.04"
  eventLogger: journald
  hostname: worker2.otodiginet.com
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.4.0-26-generic
  linkmode: dynamic
  memFree: 5036441600
  memTotal: 8319868928
  ociRuntime:
    name: crun
    package: 'crun: /usr/bin/crun'
    path: /usr/bin/crun
    version: |-
      crun version UNKNOWN
      commit: ea1fe3938eefa14eb707f1d22adff4db670645d6
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: true
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.1.8
      commit: unknown
      libslirp: 4.3.1-git
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.4.3
  swapFree: 968105984
  swapTotal: 968105984
  uptime: 53m 43.76s
registries:
  search:
  - docker.io
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 0
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.3.1
  Built: 0
  BuiltTime: Wed Dec 31 16:00:00 1969
  GitCommit: ""
  GoVersion: go1.16.6
  OsArch: linux/amd64
  Version: 3.3.1

5. Using Podman (Example)

In this stage, we will try to use podman by pulling any applications to run on Podman. On this example we will run mariadb on podman. For this purpose, we will do following command lines :

$ podman search mariadb
$ sudo podman pull mariadb
$ sudo podman images
$ sudo podman ps -a

Output :

rapik@worker2:~$ podman search mariadb
INDEX       NAME                                                          DESCRIPTION                                      STARS       OFFICIAL    AUTOMATED
docker.io   docker.io/library/mariadb                                     MariaDB Server is a high performing open sou...  4413        [OK]        
docker.io   docker.io/linuxserver/mariadb                                 A Mariadb container, brought to you by Linux...  257                     
docker.io   docker.io/webhippie/mariadb                                   Docker image for mariadb                         23                      [OK]
docker.io   docker.io/centos/mariadb-101-centos7                          MariaDB 10.1 SQL database server                 12                      
docker.io   docker.io/wodby/mariadb                                       Alpine-based MariaDB container image with or...  6                       [OK]
docker.io   docker.io/mariadb/server                                      MariaDB Server is a modern database for mode...  39                      [OK]
docker.io   docker.io/ansibleplaybookbundle/mariadb-apb                   An APB which deploys RHSCL MariaDB               0                       [OK]
docker.io   docker.io/jc21/mariadb-aria                                   Extension of the mariadb image that forces a...  16                      
docker.io   docker.io/centos/mariadb-102-centos7                          MariaDB 10.2 SQL database server                 6                       
docker.io   docker.io/kitpages/mariadb-galera                             MariaDB with Galera                              2                       [OK]
docker.io   docker.io/mariadb/maxscale                                    MariaDB MaxScale - The world's most advanced...  16                      [OK]
docker.io   docker.io/colinmollenhour/mariadb-galera-swarm                MariaDb w/ Galera Cluster, DNS-based service...  34                      [OK]
docker.io   docker.io/centos/mariadb-103-centos7                          MariaDB 10.3 SQL database server                 1                       
docker.io   docker.io/lsioarmhf/mariadb                                   ARMHF based Linuxserver.io image of mariadb      17                      
docker.io   docker.io/rightctrl/mariadb                                   Mariadb with Galera support                      2                       [OK]
docker.io   docker.io/jelastic/mariadb                                    An image of the MariaDB SQL database server ...  0                       
docker.io   docker.io/clearlinux/mariadb                                  MariaDB relational database management syste...  3                       [OK]
docker.io   docker.io/panubo/mariadb-galera                               MariaDB Galera Cluster                           22                      [OK]
docker.io   docker.io/bianjp/mariadb-alpine                               Lightweight MariaDB docker image with Alpine...  15                      [OK]
docker.io   docker.io/toughiq/mariadb-cluster                             Dockerized Automated MariaDB Galera Cluster ...  41                      [OK]
docker.io   docker.io/demyx/mariadb                                       Non-root Docker image running Alpine Linux a...  0                       
docker.io   docker.io/arm64v8/mariadb                                     MariaDB Server is a high performing open sou...  19                      
docker.io   docker.io/tiredofit/mariadb                                   Docker MariaDB server w/ S6 Overlay, Zabbix ...  2                       [OK]
docker.io   docker.io/ccitest/mariadb                                     CircleCI test images for MariaDB                 0                       [OK]
docker.io   docker.io/jonbaldie/mariadb                                   Fast, simple, and lightweight MariaDB Docker...  2                       [OK]
quay.io     quay.io/bitnami/mariadb                                       Official build of [Bitnami MariaDB](https://...  0                       
quay.io     quay.io/centos7/mariadb-103-centos7                           MariaDB is a multi-user, multi-threaded SQL ...  0                       
quay.io     quay.io/openstack.kolla/centos-source-mariadb-clustercheck                                                     0                       
quay.io     quay.io/openstack.kolla/centos-source-mariadb-server                                                           0                       
quay.io     quay.io/openstack.kolla/ubuntu-source-mariadb-clustercheck                                                     0                       
quay.io     quay.io/openstack.kolla/ubuntu-source-mariadb-server                                                           0                       
quay.io     quay.io/bitnami/mariadb-galera                                                                                 0                       
quay.io     quay.io/tripleovictoria/openstack-mariadb                     Container image openstack-mariadb:current-tr...  0                       
quay.io     quay.io/tripleomaster/openstack-mariadb                       Container image openstack-mariadb                0                       
quay.io     quay.io/startx/mariadb                                                                                         0                       
quay.io     quay.io/koray/mariadb-operator                                                                                 0                       
quay.io     quay.io/tripleowallaby/openstack-mariadb                      Container image openstack-mariadb                0                       
quay.io     quay.io/tripleotraincentos8/centos-binary-mariadb             Container image centos-binary-mariadb            0                       
quay.io     quay.io/tripleoussuri/centos-binary-mariadb                   Container image centos-binary-mariadb:curren...  0                       
quay.io     quay.io/kiegroup/jboss-kie-mariadb-extension-openshift-image                                                   0                       
quay.io     quay.io/openstack.kolla/debian-source-mariadb-clustercheck                                                     0                       
quay.io     quay.io/manojdhanorkar/mariadb-operator                                                                        0                       
quay.io     quay.io/openstack.kolla/debian-source-mariadb-server                                                           0                       
quay.io     quay.io/openstack.kolla/centos-binary-mariadb-clustercheck                                                     0                       
quay.io     quay.io/opencast/allinone                                     # [Opencast Docker images](https://quay.io/o...  0                       
quay.io     quay.io/openstack.kolla/centos-binary-mariadb-server                                                           0                       
quay.io     quay.io/linuxserver.io/mariadb                                                                                 0                       
quay.io     quay.io/tripleotrain/centos-binary-mariadb                    Container image centos-binary-mariadb:curren...  0                       
quay.io     quay.io/openstack.kolla/centos-source-mariadb                                                                  0                       
quay.io     quay.io/openstack.kolla/ubuntu-source-mariadb    
rapik@worker2:~$ sudo podman pull mariadb
✔ docker.io/library/mariadb:latest
Trying to pull docker.io/library/mariadb:latest...
Getting image source signatures
Copying blob b4cd9409b0f6 done  
Copying blob 5c37daf8b6b5 done  
Copying blob dbcda06785eb done  
Copying blob 034655750c88 done  
Copying blob f0b757a2a0f0 done  
Copying blob 7b1a6ab2e44d done  
Copying blob a34cd90f184c done  
Copying blob fd6cef4ce489 done  
Copying blob 3cb89a1550ea done  
Copying blob df9f153bd930 done  
Copying config 12e05d5da3 done  
Writing manifest to image destination
Storing signatures
12e05d5da3c5223e9877e8eb90d68560ff66cedcb955131061d60d093a908f0c
rapik@worker2:~$ sudo podman images
REPOSITORY                 TAG         IMAGE ID      CREATED      SIZE
docker.io/library/mariadb  latest      12e05d5da3c5  12 days ago  416 MB
rapik@worker2:~$ sudo podman ps -a
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES
rapik@worker2:~$ sudo podman run -d  --name otomariadb docker.io/library/mariadb
6ae59b21c7352c3520a473b0b4351bccaa2dcfa0bab48b986cf878fee1bbd5fe
rapik@worker2:~$ sudo podman ps -a
CONTAINER ID  IMAGE                             COMMAND     CREATED        STATUS                    PORTS       NAMES
6ae59b21c735  docker.io/library/mariadb:latest  mysqld      7 seconds ago  Exited (1) 6 seconds ago              otomariadb
rapik@worker2:~$ 

Conclusion

On this tutorial we have learnt how to install Podman on Ubuntu 20.04 LTS operating system successfully.

Add a Comment

Your email address will not be published. Required fields are marked *