If you’re working with containers on Red Hat Enterprise Linux (RHEL), you’ve likely heard of Docker. However, there’s another powerful tool you can use: Podman. This tutorial will walk you through installing Podman on RHEL 9 and explore its advantages over Docker.
What is Podman?
Podman is a container management tool part of the lib pod library. It allows you to create, manage, and maintain containers and Pods like Docker, but with a few key differences. Podman is designed to be a more secure and lightweight alternative, especially for environments where security and resource efficiency are paramount.
Comparing Podman to Docker
While Podman and Docker are both popular container management tools, Podman has some distinct advantages:
- Security Focus: Unlike Docker, Podman doesn’t require a daemon running as the root user. It can run containers as unprivileged users, reducing the attack surface and enhancing the security of your system. Even if a container is compromised, the attacker won’t have root access to the host system.
- Daemonless Architecture: Podman operates without a central daemon. Each Podman command runs in its own process, which makes it more resource-efficient and less prone to system-wide failures.
- Systemd Integration: Podman integrates seamlessly with systemd, the service manager used by many Linux distributions, including RHEL. This integration simplifies managing containers as system services.
Setting Up Podman on RHEL 9
Let’s dive into the installation process. Here’s how you can set up Podman on your RHEL 9 server.
Check Your System
First, ensure that your RHEL 9 server is up and running. You can check your system details with the following command:
$ uname -a
Linux rhel-9-1 5.14.0-162.6.1.el9_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Sep 30 07:36:03 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
Verify Subscription
Make sure your system is registered with Red Hat’s subscription management. You can verify this by running:
$ sudo subscription-manager identity
system identity: <removed>
name: rhel-9-1
org name: 1100xxxx
org ID: 1100xxxx
Install Podman
With your system and subscription in place, install Podman using dnf:
$ sudo dnf install podman
This command will download and install the latest version of Podman available for RHEL 9.
Verify Installation
Once installed, check the version of Podman to ensure it’s correctly installed:
$ podman --version
podman version 4.9.4-rhel
Try some of the commands to verify the Podman is working.
$ podman pull nginx
$ podman images
$ podman run -dt -p 8080:80/tcp nginx:latest
9bc336cb7d9f9d8583e9e68ec23bc7a79081823cd7b070b4486e98153dd01cc4
Optional – Installing podman-compose
on RHEL 9
podman-compose
is a tool that helps you manage single or multi-container applications using Podman
, similar to how docker-compose
works with Docker. It reads a podman-compose.yml
file and simplifies container orchestration.
Prerequisites
Ensure Python is installed on your system:
$ python -V
Python 3.9.14
Step 1: Install pip
Ensure pip
(Python package manager) is installed and up-to-date:
$ python -m ensurepip --upgrade
Step 2: Install podman-compose
Use pip
to install podman-compose
:
$ python -m pip install podman-compose
Step 3: Verify Installation
Confirm that podman-compose
is installed:
$ podman-compose --version
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 5.3.1
podman-compose version 1.0.6
podman --version
podman version 5.3.1
exit code: 0
Now you’re ready to define and manage multi-container setups using a podman-compose.yml
file!
For more details, check the official repository: podman-compose GitHub and you can also find sample podman-compose.yml
(or docker-compose.yml
) in this repository: github.com/iamgini/podman-usecases
Podman’s Unique Features
Podman offers several features that make it stand out, especially when compared to Docker:
- Pod Creation: Podman makes it easy to create pods, which are groups of containers that share the same network namespace. This is particularly useful for developers who are familiar with Kubernetes, where the pod concept is central.
- Kubeify Feature: Podman’s Kubeify feature allows you to generate Kubernetes manifests directly from your containers and pods, making it easy to migrate to a Kubernetes environment.
- Better Tools and Extensions: Podman provides a streamlined set of tools for pulling images, managing security, and auditing. It also allows for better customization through extensions, which can be added directly in the Podman Desktop application.
- Rootless Mode: Podman’s rootless mode is a key security feature. Unlike Docker, where the daemon runs as root, Podman’s containers run with user namespaces and SELinux, ensuring that even if a container is compromised, the attacker only has limited access.
Conclusion
Podman is a powerful and secure alternative to Docker, particularly suited for environments where security and resource efficiency are top priorities. With its daemonless architecture, rootless mode, and strong integration with systemd, Podman is a great choice for managing containers on RHEL 9.
Installing and getting started with Podman is straightforward, as shown in this tutorial. Whether you’re migrating from Docker or starting fresh, Podman provides all the tools you need to effectively manage your containerized applications.
Consider giving Podman a try and take advantage of its robust features and security-focused design!