This guide intends to teach you to Install and Use Podman on AlmaLinux 9.
Podman is an open-source, Linux-native tool designed to develop, manage, and run containers and pods under the Open Container Initiative (OCI) standards. Presented as a user-friendly container orchestrator developed by Red Hat, Podman is the default container engine in RedHat 8 and CentOS 8.
It is one of a set of command-line tools designed to handle different tasks of the containerization process, that can work as a modular framework. This set includes:
- Podman – pods and container image manager
- Buildah – a container builder
- Skopeo – a container image inspection manager
- runc – container runner and feature builder to podman and buildah
- crun – optional runtime that allows greater flexibility, control, and security for rootless containers
These tools can also work with any OCI-compatible container engine, like Docker, making it easy to transition to Podman or use it with an existing Docker installation.
Steps To Install and Use Podman on AlmaLinux 9
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with AlmaLinux 9.
Install Podman on AlmaLinux 9
First, you need to update and upgrade your local package index with the following command:
sudo dnf update && sudo dnf upgrade
Podman packages are available in the default AlmaLinux repository. So use the following command to install Podman on your server:
sudo dnf install podman -y
Then, verify your installation by checking its version:
Output podman version 4.2.0
Start and Enable Podman Service
Start and enable your Podman service by using the following commands:
# sudo systemctl start podman # sudo systemctl enable podman
Check your podman service is active and running on AlmaLinux 9:
sudo systemctl status podman
Output ● podman.service - Podman API Service Loaded: loaded (/usr/lib/systemd/system/podman.service; enabled; vendor pr> Active: active (running) since Mon 2023-01-16 08:20:49 EST; 2s ago TriggeredBy: ● podman.socket Docs: man:podman-system-service(1) Main PID: 72191 (podman) Tasks: 7 (limit: 23609) Memory: 21.1M CPU: 132ms CGroup: /system.slice/podman.service ...
To get full information about Podman, you can use:
Output host: arch: amd64 buildahVersion: 1.27.1 cgroupControllers: - cpuset - cpu - io - memory - hugetlb - pids - rdma - misc cgroupManager: systemd cgroupVersion: v2 conmon: package: conmon-2.1.4-1.el9.x86_64 ...
When your installation is completed, you can proceed to the next step to install Podman compose.
Set up Podman Compose
If you plan to use Docker Compose with Podman backend to make it run docker-compose.yml unmodified and rootless or create a new one can use the following command. In short, it is a drop-in replacement for docker-compose.
First, install the Epel repository on AlmaLinux 9:
sudo dnf install epel-release -y
Then, use the following command to install Podman Compose:
sudo dnf install podman-compose -y
Use docker as a command tool instead of Podman (optional)
To use docker as a command tool instead of Podman, you can install the podman-docker.
This means you can use the familiar docker command while underlying Podman will be executing.
sudo dnf install podman-docker
Then, check the versions:
These will give you the same result.
Output Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. podman version 4.2.0
Use Podman on AlmaLinux 9
Now that you have installed Podman on your server let’s see its basic usage.
Search and pull images with Podman
Just like Docker, you can use the Podman command line to search Images but from different repositories.
For example, if you want to install an AlmaLinux container using Podman, then you can search what are the images available through the different repositories.
podman search almalinux
Then, you can download and pull images with the following command:
podman pull almalinux
List all Images with Podman
If you have downloaded multiple images and now want to see what are the available images on your system, you can list all of them using the following command:
In my case:
Output REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/almalinux latest acaca326f3b3 6 weeks ago 196 MB
Create a Container with Podman
Once you have the image of the application that you want, you can create a container with it. Here we have downloaded the AlmaLinux image with Podman. Now we will show how to use it to create a container using AlmaLinux Image.
To do this, you can use the following command:
podman run -dit --name orca almalinux
Note: –name is a parameter to give the container whatever friendly name you want to assign.
To access your Container command line, use the following command:
podman attach orca
You will see that your command prompt changes to your container ID:
To start your container, you can use the command below:
podman start container-id or name
To stop your container, you can use the following command:
podman stop container-id or name
For more information, you can visit the Podman Documentation page.
At this point, you have learned to Install and Use Podman on AlmaLinux 9.
Hope you enjoy it. You may be interested in these articles: