Podman Architecture and Deployment on CentOS Stream

The intersection of CentOS Stream and Podman represents a strategic shift in how containerization is handled within the Red Hat ecosystem. As the upstream development branch for Red Hat Enterprise Linux (RHEL), CentOS Stream provides a unique environment where enterprise-grade stability meets the rapid iteration of modern container tooling. Podman, a daemonless and rootless container engine, is not merely a compatible tool for this platform but is tightly integrated into the OS architecture. This integration ensures that users receive timely updates and a consistent operational experience that mirrors production RHEL deployments worldwide. By removing the centralized daemon requirement characteristic of older container engines, Podman mitigates single-point-of-failure risks and significantly enhances the security posture of the host system, particularly through its native support for rootless containers and SELinux integration.

Platform Compatibility and Environment Requirements

Deploying Podman requires a foundational understanding of the target operating system's lifecycle and the necessary system privileges. The suitability of the host environment directly impacts the stability and the update path of the container engine.

The primary supported platform is CentOS Stream 9, which serves as the modern standard for those seeking a production-ready yet forward-looking environment. However, users may still encounter CentOS Stream 8 systems. It is critical to note that CentOS Stream 8 reached its end of life on May 31, 2024. This expiration means that standard repositories for version 8 no longer receive updates, which can lead to security vulnerabilities and software incompatibilities. Consequently, the transition to CentOS Stream 9 or CentOS Stream 10 is highly recommended for any professional deployment.

To successfully initialize a Podman environment, the following prerequisites must be met:

  • A system running CentOS Stream 9 (preferred), CentOS Stream 10, or a legacy CentOS Stream 8 installation.
  • A user account granted with sudo privileges to perform package installation and system-level configuration.
  • An active and stable internet connection to reach the official repositories and image registries.

Comprehensive Installation Workflow

The installation of Podman on CentOS Stream is streamlined because the tool is included in the default system repositories. This ensures that the binary is optimized for the specific kernel and library versions present in the Stream distribution.

The process begins with a full system update to ensure that all dependencies are current and that the kernel is patched against known vulnerabilities. This is achieved through the following command:

sudo dnf update -y

Once the system is current, Podman can be installed via the DNF package manager. For those utilizing CentOS Stream 9, the command is as follows:

sudo dnf install -y podman

In the context of CentOS Stream 10, the same package manager approach is utilized, leveraging the official repositories to ensure that the installation is consistent with the OS's package management standards. For users who require the absolute latest features and are not concerned with production stability, there are "bleeding-edge" options. This involves the use of a Copr repository, which contains RPM builds generated from the main branch of the upstream container tools repositories.

To enable the Copr repository and install the next-generation version of Podman, the following steps are required:

sudo dnf copr enable rhcontainerbot/podman-next -y

sudo dnf install podman

It must be emphasized that the Copr repository is not recommended for production use due to the experimental nature of the builds. Similarly, users on Fedora can utilize the updates-testing repository for early access:

sudo dnf update --refresh --enablerepo=updates-testing podman

Rootless Configuration and User Mapping

One of the most significant advantages of Podman is its ability to run containers without root privileges. This "rootless" mode prevents a compromised container from gaining root access to the host system, thereby isolating the container's impact.

To achieve rootless operation, Podman relies on subordinate User ID (UID) and Group ID (GID) mappings. These mappings allow the container to believe it is running as root inside the container while actually being mapped to a non-privileged user on the host.

Administrators can verify existing mappings by examining the following files:

cat /etc/subuid

cat /etc/subgid

If the current user is missing the necessary entries, they must be added to allow the user to map a range of IDs. The standard range is typically 100,000 to 165,535. This is configured using the following command:

sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER

After updating the mappings, the system must be notified of the change to ensure the container runtime acknowledges the new identity range:

podman system migrate

To verify that rootless mode is functioning correctly, the user can inspect the UID map through the following command:

podman unshare cat /proc/self/uid_map

A practical verification involves running a lightweight Alpine Linux container to check the identity of the process:

podman run --rm docker.io/library/alpine:latest id

Container Lifecycle Management

The operational lifecycle of a container encompasses pulling images, executing instances, and managing their termination. Podman provides a comprehensive set of tools to handle these tasks without requiring a background daemon.

Pulling and Executing Containers

Retrieving an image from a registry is the first step in deployment. For example, to pull the latest Nginx image, the following command is used:

podman pull docker.io/library/nginx:latest

Once the image is available locally, it can be started as a detached background process. Mapping the host port 8080 to the container port 80 allows external traffic to reach the web server:

podman run -d --name webserver -p 8080:80 docker.io/library/nginx:latest

Users can confirm the status of running containers using the process list command:

podman ps

To verify the connectivity of the deployed web server, a simple curl request can be sent to the mapped port:

curl http://localhost:8080

For development and debugging, interactive containers are essential. The following command launches a CentOS Stream 9 shell, allowing the user to execute commands inside the container environment:

podman run -it --rm docker.io/library/centos:stream9 bash

Container Termination and Removal

Managing the cleanup of resources is vital to prevent disk exhaustion. To stop a specific container, such as the Nginx instance mentioned previously, the stop command is used:

podman stop nginx-container

Once a container is stopped, it still exists in the system's memory as a stopped instance. To completely remove the container and its associated metadata, the remove command is executed:

podman rm nginx-container

Image Management and Analysis

Podman provides a robust set of tools for searching, inspecting, and cleaning up container images. Because Podman is daemonless, it interacts directly with registries.

Image Discovery and Inspection

Users can list all images currently stored on the local host using:

podman images

To find new images available in the registries, the search command is utilized:

podman search nginx

For more granular detail, such as listing specific tags associated with an image, the following command is used:

podman search --list-tags docker.io/library/nginx

Before pulling a large image, it is often beneficial to inspect the image metadata to verify its version and architecture. This is handled by the Skopeo tool, which is part of the container toolset:

skopeo inspect docker://docker.io/library/nginx:latest

Image Cleanup

Over time, unused images accumulate and consume significant disk space. Individual images can be removed using the remove image command:

podman rmi docker.io/library/nginx:latest

For a more comprehensive cleanup of all unused images, the prune command is employed:

podman image prune -a

Custom Image Construction

Creating custom images allows developers to package their applications with all necessary dependencies. Podman uses a Containerfile (similar to a Dockerfile) to define the build process.

Developing a Containerfile

For a Python application based on CentOS Stream 9, a typical Containerfile would look like this:

dockerfile FROM quay.io/centos/centos:stream9 RUN dnf install -y python3 python3-pip && \ dnf clean all WORKDIR /app COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt COPY app.py . EXPOSE 8000 CMD ["python3", "app.py"]

This configuration ensures that the base image is a clean CentOS Stream 9 environment, installs Python 3 and Pip, cleans the package cache to reduce image size, sets the working directory, installs dependencies, and defines the startup command.

Building the Image

The image is built from the local directory using the build command:

podman build -t myapp:latest .

For more advanced image manipulation, such as modifying a container's filesystem without a full rebuild, Buildah can be used. An example of initializing a Buildah container is:

container=$(buildah from quay.io/centos/centos:stream9)

buildah run

Network and Security Configuration

Containers must be properly integrated with the host's network and security policies to be functional and secure.

Firewall Configuration

On CentOS Stream, the default firewall may block traffic to container ports. To allow access to a container mapped to port 8080, the following firewall commands are necessary:

sudo firewall-cmd --add-port=8080/tcp --permanent

sudo firewall-cmd --add-service=http --permanent

sudo firewall-cmd --reload

Verification of the current firewall rules can be performed with:

sudo firewall-cmd --list-all

SELinux Integration

Security-Enhanced Linux (SELinux) is a core component of CentOS Stream. While it provides critical security, it can sometimes block container access to host volumes. If a user encounters an "SELinux error" during volume mounting, the :z flag must be added to the mount command. This flag tells Podman to relabel the files so the container has the correct permissions:

podman run -v /host/path:/container/path:z nginx

Advanced Operational Management

For production-grade deployments, Podman offers advanced features for health monitoring, automatic updates, and system maintenance.

Container Health Checks

Health checks ensure that a container is not just "running" but is actually functioning. A health check can be defined during the container start process using the --health-cmd flag:

podman run -d --name webapp \ --health-cmd="curl -f http://localhost:8000/health || exit 1" \ --health-interval=30s \ --health-retries=3 \ --health-timeout=5s \ -p 8080:8000 \ myapp:latest

The health status can be checked manually using:

podman healthcheck run webapp

Or by inspecting the container state:

podman inspect --format '{{.State.Health.Status}}' webapp

Automated Updates

To maintain the security and currency of containers, Podman supports automatic image updates. This is managed via a systemd timer:

sudo systemctl enable --now podman-auto-update.timer

To verify which containers would be updated without actually performing the operation, a dry run can be executed:

podman auto-update --dry-run

System Maintenance and Cleanup

Regular maintenance prevents the container engine from consuming excessive host resources. Disk usage can be analyzed with:

podman system df

To remove all stopped containers:

podman container prune

To remove all unused images:

podman image prune -a

For a total system cleanup, including volumes, the following command is used:

podman system prune -a --volumes

Troubleshooting and Documentation

Despite the stability of Podman, certain common issues may arise during installation and operation.

Common Error Resolutions

If a user encounters the error podman: command not found, it is a clear indication that the package was not installed. The solution is to run the installation command again:

sudo dnf install -y podman

For issues related to networking, it is important to note that slirp4netns is no longer the default for rootless networking in newer installations, having been obsoleted in favor of passt.

Documentation Access

For deep-level technical details, Podman provides extensive manual pages. The general manual is accessed via:

man podman

To find information on a specific subcommand, the following syntax is used:

man podman subcommand

General help and command lists can be retrieved using the help flag:

podman --help

podman subcommand --help

Cross-Platform Comparisons and Alternative Installations

While this guide focuses on CentOS Stream, Podman is available across multiple distributions, each with specific installation methods.

Operating System Installation Command Note
CentOS Stream 9+ sudo dnf -y install podman Available in AppStream repo
Ubuntu 20.10+ sudo apt-get -y install podman Available in official repos
Debian 11+ sudo apt-get -y install podman Available in Bullseye repositories
ArchLinux sudo pacman -S podman Standard package manager
Alpine Linux sudo apk add podman Lightweight package manager
macOS brew install podman Requires Homebrew installation
Windows N/A Uses WSL2 distribution

For macOS and Windows users, Podman operates through a virtual machine. On macOS, the process involves initializing and starting a Podman machine:

podman machine init

podman machine start

On Windows, Podman is backed by the Windows Subsystem for Linux (WSLv2). The podman command is executed from PowerShell or CMD, communicating remotely with the service running within the WSL environment.

Final Analysis of Podman on CentOS Stream

The deployment of Podman on CentOS Stream 9 and 10 represents a sophisticated approach to containerization that prioritizes security and system integrity. By leveraging a daemonless architecture, Podman eliminates the central point of failure and security vulnerability inherent in traditional container engines. The integration with SELinux and the support for rootless containers via UID/GID mapping provide a security layer that is essential for modern enterprise environments.

The transition from legacy systems like CentOS Stream 8 to Stream 9 is not merely a version update but a necessity for maintaining security, as the end-of-life status of version 8 renders its repositories obsolete. For the developer, the ability to use Buildah for granular image construction and Skopeo for image inspection creates a powerful toolchain that extends beyond simple container execution.

Furthermore, the evolution of container management—moving away from deprecated commands toward Quadlets for systemd integration—shows a trajectory toward more native Linux integration. When combined with automatic updates and robust health checks, Podman on CentOS Stream delivers a production-ready platform that mimics the robustness of RHEL. This environment provides the flexibility for rapid development while maintaining the rigor required for large-scale, enterprise-grade container deployments.

Sources

  1. Podman Installation Guide - GitHub
  2. Podman on CentOS Stream 9 - OneUpTime
  3. Podman on CentOS Stream 10 - InfoTechys
  4. Podman Official Installation Docs
  5. Podman Get Started Guide

Related Posts