How to install the Podman container engine on CentOS 8

If you use either Red Hat or CentOS to deploy your containers, you'll want to get up to speed with Podman.

How to install the Podman container engine on CentOS 8

Now that official support for the Docker container runtime has been dropped by RHEL 8/CentOS 8, what are container admins to do? Fortunately, the developers at Red Hat have been working on libpod for some time. Libpod is the new container management library, which includes everything necessary to manage pods, containers, and container images.

That new solution is called Podman which functions without requiring a container daemon, as all containers and pods are created as child processes. To everyone who has spent weeks, months, and years getting up to speed with the docker runtime, you have nothing to fear as the Podman CLI is based on the docker CLI.

I want to walk you through the steps for installing and using Podman on CentOS 8. 

SEE: CentOS: A how-to guide (free PDF) (TechRepublic)

What you'll need

The only things you'll need to make this work are:

  • A running instance of CentOS 8

  • A user account with sudo privileges

How to install Podman

Podman doesn't have its own installation package, because it is a part of another tool. So to gain access to Podman, open a terminal window on your CentOS 8 server and issue the command:

sudo dnf install @container-tools -y

That's all there is to the installation.

SEE: Serverless computing: A guide for IT leaders (TechRepublic Premium)

How to use Podman

Let me show you how similar to Docker Podman is. Say, for instance you want to pull an image. If you've used the Docker pull command, you'll recognize:

podman pull ubuntu

To list your existing images, issue the command:

podman images

The above command will list out all of the images you've pulled, along with the image ID.

To delete an image, you can do so using the image ID, just like you do with the Docker runtime. Issue the command:

podman rmi ID

Where ID is the ID of the image to be deleted.

Now, let's say you want to deploy a container using the newly-downloaded Ubuntu image. I'm going to demonstrate an incredibly basic container deployment, one that will deploy a container based on the Ubuntu image and then use the echo command from within the container to print out the message, "Welcome to TechRepublic." 

To deploy this container with Podman, issue the command:

podman run --rm ubuntu /bin/echo "Welcome to TechRepublic."

You should almost immediately see the text printed out (Figure A).

Figure A


Our container was deployed.

Of course, that container isn't going to do you much good. Let's deploy a container that routes external port 8080 to internal port 8080. This can be done with the command:

sudo podman run -dit --name ubuntu-apache -p 8080:8080 ubuntu

We have to run this command with sudo as port bindings are not yet supported by rootless containers. 

To list your running containers you will have to, again, make use of sudo like so:

sudo podman ps

The above command will list out your running containers (Figure B).

Figure B


Our running container.

To stop that container, issue the command:

sudo podman stop ID

Where ID is the name of the container ID.

To delete the now stopped container, issue the command:

sudo podmand rm ID

Where ID is the name of the container ID.

And that's the gist of installing and using the new container runtime engine, Podman. Stay tuned for more how-tos centered around this new technology.

Also see


Image: CentOS