Install and Use Podman on Rocky Linux 8: Free Container Management
In this article, we will guide you through the process to Install and Use Podman on Rocky Linux 8. Podman is a powerful, open-source container management tool that allows you to develop, manage, and run OCI (Open Container Initiative) containers. It offers a daemon-less architecture, enhancing security and resource efficiency compared to traditional container solutions.
Advantages of Podman:
- Daemon-less Architecture: Podman doesn’t require a central daemon like Docker, improving security and reducing resource overhead.
- Rootless Containers: Podman supports running containers without root privileges, further enhancing security.
- Docker Compatibility: Podman is largely compatible with Docker images and commands, making migration easier.
- Pod Support: Podman allows you to manage groups of containers as pods, similar to Kubernetes.
- Integration with Systemd: Podman integrates seamlessly with Systemd for managing container lifecycles.
To follow this guide, ensure you have a Rocky Linux 8 server and are logged in as a non-root user with sudo privileges. If you haven’t already, refer to a guide like the "Initial Server Setup with Rocky Linux 8" for assistance.
1. Install Podman on Rocky Linux 8
First, update your system’s package index and upgrade existing packages to their latest versions. This ensures you have the most recent dependencies for Podman.
sudo dnf update && sudo dnf upgrade
Next, install Podman using the dnf
package manager. Podman packages are readily available in the default Rocky Linux 8 repository.
sudo dnf install podman -y
After the installation is complete, verify that Podman is installed correctly by checking its version.
podman --version
**Output**
podman version 4.2.0
Manage Podman Service
While Podman doesn’t require a persistent daemon, you can manage its user service for managing containers that should run when a user is logged in. Start and enable the Podman user service with the following commands:
# sudo systemctl start podman
# sudo systemctl enable podman
Verify that the Podman user service is active and running:
sudo systemctl status podman

For comprehensive information about Podman and its configuration, use the podman info
command.
podman info

With Podman successfully installed, you can proceed to install Podman Compose.
2. Podman Compose Setup
Podman Compose enables you to use Docker Compose files with Podman, allowing you to define and manage multi-container applications easily. It functions as a drop-in replacement for Docker Compose.
First, enable the Extra Packages for Enterprise Linux (EPEL) repository, which contains the podman-compose
package.
sudo dnf install epel-release -y
Then, install Podman Compose using dnf
:
sudo dnf install podman-compose -y
Use docker as a command tool instead of Podman (optional)
To use the familiar docker
command while actually executing Podman commands, install the podman-docker
package.
sudo dnf install podman-docker -y
You can then verify the setup by checking the version using either podman
or docker
.
podman -v
or
docker -v
These commands will produce the same result, indicating that the docker
command is aliased to podman
.
**Output**
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
podman version 4.2.0
3. How To Use Podman on Rocky Linux 8?
Now that you have installed Podman on your server let’s explore its basic usage. This section will cover essential commands for managing images and containers.
Search and pull images with Podman
Similar to Docker, you can use the Podman command line to search for images in container registries.
For example, to search for available AlmaLinux images:
podman search almalinux
To download an image, use the podman pull
command:
podman pull almalinux
List all Images with Podman
To view a list of all images currently stored on your system, use the podman images
command.
podman images
In my case:
**Output**
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/almalinux latest acaca326f3b3 2 months ago 196 MB
Create a Container with Podman
Once you have downloaded the image you need, you can create a container based on that image. Here’s how to create a container from the AlmaLinux image we downloaded earlier.
podman run -dit --name orca almalinux
Note: The --name
parameter assigns a user-friendly name to the container.
To access the container’s command line, use the podman attach
command:
podman attach orca
This will change your command prompt to reflect that you are now inside the container:
reita@354de80d5f8c:/#
To start a container, use the following command:
podman start <container-id> or <name>
To stop a container, use the following command:
podman stop <container-id> or <name>
For more detailed information and advanced usage, refer to the Podman Documentation page.
Alternative Solutions for Container Management on Rocky Linux 8
While Podman is an excellent choice for container management, here are two alternative approaches you might consider:
1. Using Docker Community Edition (Docker CE)
Although Podman is a popular choice on systems like Rocky Linux, Docker CE is still a valid option. It provides a comprehensive containerization platform, including a daemon, CLI, and API.
-
Explanation: Docker CE offers a mature and widely adopted ecosystem. While it requires a daemon, it provides a rich set of features and tools for container management.
-
Installation and Basic Usage:
First, add the Docker repository:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Install Docker CE:
sudo dnf install docker-ce docker-ce-cli containerd.io -y
Start and enable the Docker service:
sudo systemctl start docker sudo systemctl enable docker
Now you can use Docker commands:
docker run -d -p 80:80 nginx
This example runs an Nginx container, mapping port 80 on the host to port 80 in the container.
2. Using Buildah for Image Building
Buildah focuses specifically on building container images, without requiring a daemon or root privileges. It is an excellent companion tool for Podman.
-
Explanation: Buildah allows you to create container images from scratch or by modifying existing images. It provides a more granular and secure approach to image building.
-
Installation and Basic Usage:
Install Buildah:
sudo dnf install buildah -y
Create a working directory:
mkdir myimage cd myimage
Create a
Dockerfile
:FROM almalinux:latest RUN dnf install -y httpd CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
Build the image:
sudo buildah bud -t my-httpd-image .
Now you can use this image with Podman:
podman run -d -p 8080:80 my-httpd-image
These alternative solutions offer different approaches to container management on Rocky Linux 8, allowing you to choose the best fit for your specific needs and preferences. Install and Use Podman on Rocky Linux 8 is one method, and it’s worth exploring all the alternatives.
Conclusion
Podman provides a modern and secure approach to container management, particularly well-suited for environments like Rocky Linux 8. By following the steps outlined in this article, you have learned how to Install and Use Podman on Rocky Linux 8, set up Podman Compose, and execute basic container operations. Remember to explore the Podman documentation for more advanced features and options. This guide helped you to Install and Use Podman on Rocky Linux 8.