Jump to content
  • Sign Up
  • Create New...

How to install and run Podman on Rocky Linux

Pelican Press

Recommended Posts

How to install and run Podman on Rocky Linux

Docker has been one of the most popular default container runtime engines for users because of how straightforward it is. However, Red Hat has changed the way it supports running Docker, which causes users to switch to Podman.

Security is a speculated reason why Red Hat changed its support for Docker. Podman is a close replacement for Docker. With Podman, admins can easily deploy containers without root access privileges.

Docker and Podman are relatively similar to use. If you’ve used neither technology, follow this tutorial that walks you through the first steps to install and run Podman on Rocky Linux.

What you need

The only requirements are a running instance of Rocky Linux and a user with sudo privileges.

Installing Podman

Podman should be installed by default on Rocky Linux. To check, log in, open a terminal window and issue the command:

podman -v

The output should look something like this:

podman version 4.6.1

If a command not found error appears, install Podman with the following command:

sudo dnf install podman -y

Step 1. Pulling an image

With Podman installed, it’s time to take the first step, which is to search for and pull an image down from one of the repositories. Use the Nginx web server container. First, search for Nginx with the following command:

podman search nginx

You should see several entries in the output, which includes the following options:

  • docker.io/library/nginx Official build of Nginx.
  • docker.io/library/unit Official build of NGINX Unit: Universal Web…
  • docker.io/nginx/nginx-ingress NGINX and  NGINX Plus Ingress Controllers fo…
  • docker.io/nginxinc/nginx-unprivileged  Unprivileged NGINX Dockerfiles.
  • docker.io/nginx/nginx-prometheus-exporter  NGINX Prometheus Exporter for NGINX and NGINX…

There are also numerous entries from registry.redhat.io. Pull the latest version of the official Nginx image from the Docker repository with the following command:

podman pull nginx:latest

The following three options should appear:

  1. registry.access.redhat.com/nginx:latest.
  2. Registry.redhat.io/nginx:latest.
  3. docker.io/library/nginx:latest.

Use the keyboard arrow keys to scroll down to the docker.io entry, and hit the Enter key. The image should pull quickly and end with a long string of random characters, which is the unique image ID for the instance. Verify a successful pull with the following command:

podman images

You should see something similar to the following:

docker.io/library/nginx  latest      92b11f67642b  3 weeks ago  191 MB

Step 2. Deploy a container

Next, deploy a container with the pulled image. Deploy the Nginx container with the following command:

podman run –name podman-nginx -p 8080:80 -d nginx

The explanation for the above command looks like this:

  • podman. The runtime.
  • run. Tells the runtime to run what follows.
  • –name. Instructs Podman what the name of the container is.
  • podman-nginx. The name of the container.
  • -p. Informs Podman that what follows is the internal and external ports for the container.
  • 8080:80. Defines port 8080 as the external port and 80 as the internal port.
  • -d. Instructs Podman that detached mode is running.
  • nginx. The image for the container.

After you run the command, a long string of characters should appear. These characters make up the unique ID for the running container. Verify the container is running with the following command:

podman ps -a

The output should look something like this:

ef96c99c3861  docker.io/library/nginx:latest  nginx -g daemon o…  44 seconds ago  Up 44 seconds>80/tcp  podman-nginx

Congratulations, your first container is deployed and running. Users can now access the container for development purposes. To access the running container, run the following command:

podman exec -it podman-nginx /bin/bash

The output should be something like this:


That means you are now inside the running container and can use it for development or testing purposes. Once finished, exit the container with the exit command.

To stop the container, issue the following command — keeping in mind ID is the first four characters of the container ID:

podman stop ID

To delete the container, issue the following command:

podman rm ID

An easier method

Rocky Linux offers another method to run and manage Podman containers. Cockpit, a web-based admin tool that includes Podman support, runs with the following command:

sudo systemctl enable –now cockpit.socket

Once Cockpit is running, open a web browser, and point it to where SERVER is the IP address of the hosting server. Log in with a user that has sudo privileges. A list of Podman containers is on the left sidebar. Click that entry to see the podman-nginx container running. Click the three-dot menu button associated with the container, and perform any of the following: stop, force stop, restart, force restart, pause, rename, commit or delete.

Congratulations, you’ve installed Podman and deployed your first container with this powerful runtime tool.

Jack Wallen is an award-winning writer and avid promoter and user of the Linux OS.

This is the hidden content, please

#install #run #Podman #Rocky #Linux

This is the hidden content, please

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.

Important Information

Privacy Notice: We utilize cookies to optimize your browsing experience and analyze website traffic. By consenting, you acknowledge and agree to our Cookie Policy, ensuring your privacy preferences are respected.