Install and Use Podman on Rocky Linux 8

In this article, we want to show you to Install and Use Podman on Rocky Linux 8.

Podman is an open-source container management tool for developing, managing, and running OCI containers.

Advantages of Podman:

  • Images created by Podman are compatible with other container management tools
  • It can be run as a normal user without requiring root privileges
  • It provides the ability to manage pods
  • It only runs on Linux-based systems
  • There is no alternative for Docker Compose

Steps To Install and Use Podman on Rocky Linux 8

To complete this guide, log in to your server as a non-root user with sudo privileges and follow the steps below. To do this, you can check this guide on Initial Server Setup with Rocky Linux 8.

Install Podman on Rocky Linux 8

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 Rocky Linux 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:

podman --version
Output
podman version 4.2.0

Manage 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 Rocky Linux 8:

sudo systemctl status podman
Output
● podman.service - Podman API Service
   Loaded: loaded (/usr/lib/systemd/system/podman.service; enabled; vendor pres>
   Active: active (running) since Mon 2023-02-20 03:09:41 EST; 2s ago
     Docs: man:podman-system-service(1)
 Main PID: 91458 (podman)
    Tasks: 7 (limit: 23699)
   Memory: 23.0M
   CGroup: /system.slice/podman.service
           └─91458 /usr/bin/podman --log-level=info system service
...

To get full information about Podman, you can use:

podman info
Output 
  arch: amd64
  buildahVersion: 1.27.3
  cgroupControllers:
  - cpuset
  - cpu
  - cpuacct
  - blkio
  - memory
  - devices
...

When your installation is completed, you can proceed to the next step to install Podman compose.

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 Rocky Linux 8:

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 -y

Then, check the versions:

podman -v
or
docker -v

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

How To Use Podman on Rocky Linux 8

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 podman command on Rocky Linux 8:

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 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:

reita@354de80d5f8c:/#

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.

Conclusion

At this point, you have learned to Install and Use Podman on Rocky Linux 8.

Hope you enjoy using it. You may be interested in these articles:

Install Postman on Rocky Linux 8

How To Install mtr Command on Linux

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!