CentLinux | Learn How to Install CentOS/Rocky Linux Servers

Tuesday, December 24, 2019

Install Podman, a Docker Alternative on CentOS 8

How to Install Podman Containers on CentOS 8

In Red Hat Enterprise Linux (RHEL) 8, the support for Docker has been removed. Whereas, a new containerization platform libpod (Podman's Container Management Library) has been introduced in RHEL 8. Being an upstream fork, CentOS 8 also follows the same path.

Therefore, to setup a containerization platform in CentOS 8, we have to install podman (Pod Manager tool) and relevant packages on our server. Following are the CLI tools used in this new container platform.

  • podman - Client tool for managing containers.
  • skopeo - Client tool for copying container images to/from registries.
  • buildah - Client tool for building OCI (Open Container Initiative) complaince containers.
  • runc - Container runtime client for running and working with OCI format containers.

In CentOS 8 yum repository, these tools are available separately in distinct packages as well as bundled in a common module:container-tools.

The best way to install all these tools is by using the container-tools module.

In this article, we are installing Podman containers on CentOS 8 and then create and run a test container using new podman tool.

How to Install Podman Containers on CentOS 8

Table of Contents:


Environment Specification:

We have provisioned virtual machine with minimally installed CentOS 8 with following specification.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - CentOS 8.0
  • Hostname - podman-01.centlinux.com
  • IP Address - /24


Installing Podman Containers on CentOS 8:

Connect with podman-01.centlinux.com using ssh as root user.

Build dnf cache using following command.

# dnf makecache
CentOS-8 - AppStream                            2.3 kB/s | 4.3 kB     00:01
CentOS-8 - Base                                 1.7 kB/s | 3.9 kB     00:02
CentOS-8 - Extras                               649  B/s | 1.5 kB     00:02
Metadata cache created.

Install container-tools module using dnf command.

# dnf install -y @container-tools

Podman and related containerization tools has been installed on CentOS 8.


Using Podman Containers on CentOS 8:

Check Podman version.

# podman version
Version:       1.0.5
Go Version:    go1.11.6
OS/Arch:       linux/amd64

Search for an image using podman command.

# podman search alpine --filter is-official=true
INDEX       NAME                       DESCRIPTION                                       STARS   OFFICIAL   AUTOMATED
docker.io   docker.io/library/alpine   A minimal Docker image based on Alpine Linux...   5937    [OK]

Pull an image from online registry.

# podman pull docker.io/library/alpine
Trying to pull docker.io/library/alpine...Getting image source signatures
Copying blob 63bc94deeb28: 2.65 MiB / 2.67 MiB [===============================]
Copying blob 63bc94deeb28: 2.67 MiB / 2.67 MiB [============================] 9s
Copying config c85b8f829d1f: 1.48 KiB / 1.48 KiB [==========================] 0s
Writing manifest to image destination
Storing signatures

Show list of local podman images.

# podman images
REPOSITORY                 TAG      IMAGE ID       CREATED      SIZE
docker.io/library/alpine   latest   c85b8f829d1f   3 days ago   5.86 MB

Inspect the alpine Linux image for more details.

# podman inspect alpine
        "Id": "c85b8f829d1f93a25fe91d2ce7dccf7ec723794873a77bb19623d38e926c788c",
        "Digest": "sha256:d371657a4f661a854ff050898003f4cb6c7f36d968a943c1d5cde0952bd93c80",
        "RepoTags": [
        "RepoDigests": [
        "Parent": "",
        "Comment": "",
        "Created": "2019-12-19T23:21:54.894824922Z",
        "Config": {
            "Env": [
            "Cmd": [
        "Version": "18.06.1-ce",
        "Author": "",
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 5859848,
        "VirtualSize": 5859848,
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "MergedDir": "/var/lib/containers/storage/overlay/6bc83681f1baa18776614f386dee8811f0063fab656870291bd7751e74a830f4/merged",
                "UpperDir": "/var/lib/containers/storage/overlay/6bc83681f1baa18776614f386dee8811f0063fab656870291bd7751e74a830f4/diff",
                "WorkDir": "/var/lib/containers/storage/overlay/6bc83681f1baa18776614f386dee8811f0063fab656870291bd7751e74a830f4/work"
        "RootFS": {
            "Type": "layers",
            "Layers": [
        "Labels": null,
        "Annotations": {},
        "ManifestType": "application/vnd.docker.distribution.manifest.v2+json",
        "User": "",
        "History": [
                "created": "2019-12-19T23:21:54.731224548Z",
                "created_by": "/bin/sh -c #(nop) ADD file:c7d28fcb71c026d7956b381180e4792c8219b04904e726a9266322ef5b256df8 in / "
                "created": "2019-12-19T23:21:54.894824922Z",
                "created_by": "/bin/sh -c #(nop)  CMD [\"/bin/sh\"]",
                "empty_layer": true

Create and run a container from alpine Linux image.

# podman run -it --rm alpine /bin/sh
/ # uname -a
Linux 299572d7599a 4.18.0-80.el8.x86_64 #1 SMP Tue Jun 4 09:19:46 UTC 2019 x86_64 Linux
/ # cat /etc/os-release
NAME="Alpine Linux"
PRETTY_NAME="Alpine Linux v3.11"
/ # exit

Run the alpine Linux container in detach mode.

# podman run -d alpine

Check list of recent containers.

# podman ps -a
CONTAINER ID  IMAGE                            COMMAND  CREATED             STATUS                         PORTS  NAMES
f6cc375e3476  docker.io/library/alpine:latest  /bin/sh  6 seconds ago       Exited (0) 6 seconds ago              heuristic_montalcini
f3de35c18d7d  docker.io/library/alpine:latest  /bin/sh  About a minute ago  Exited (0) About a minute ago         stoic_goodall
85dcf6ee27b2  docker.io/library/alpine:latest  /bin/sh  6 minutes ago       Exited (0) 6 minutes ago              sad_benz

Remove a container.

# podman container rm f6cc375e3476

Remove all containers.

# podman container rm $(podman ps -a -q)

Remove an image.

# podman rmi docker.io/library/alpine

If you have worked with Docker, you may have observed that the command syntax of podman is exactly same as of docker. Podman is also fully compatible with Docker images.

We have successfully installed podman containers on CentOS 8. We have only explored some of the most common commands here, if you want to learn more about containers you should read Docker in Action by Manning Publications.

If you find this article useful? Consider supporting us by Buy Me A Coffee

No comments:

Post a Comment

© 2023 CentLinux. All Rights Reserved.