How to create custom images with Podman

Jack Wallen walks you through the steps to create custom images for Podman deployments using the commit command.

Close-up of a young software developer working hard at his desk
Image: baranq/Adobe Stock

Podman is a near 1:1 replacement for the Docker container engine. While they’re quite different under the hood, they’re pretty similar on top of that. One thing both can do is enable you to build your images that will be used for custom container deployments. This means you can get an official image and then commit your changes so the image can be reused for further custom deployments.

SEE: Hire Kit: Backend Developer (TechRepublic Premium)

I’ll show you how to do this using the official Ubuntu image pulled down from This allows you to customize the Ubuntu image exactly to your specs and then deploy new containers based on the modified image.

What you need to create a custom image with Podman

To participate, you need an operating system that supports Podman, such as Rocky Linux, AlmaLinux, RHEL, or CentOS.

How to pull the Ubuntu image

First, let’s pull the latest Ubuntu image from To do this, log into your Linux distribution, open a terminal window and enter the command:

podman pull ubuntu:latest

How to deploy and modify a container with the image

Next we need to deploy a container with our newly pulled image. This can be achieved with:

podman run -ti --name ubuntu-dev ubuntu:latest

You should find yourself at the bash prompt of the newly executed container.

Update apt with:

apt-get update

We now install the NGINX web server with the command:

apt-get install nginx -y

You can install any other application. For example, if you need to do some Java development, install the latest JRE with:

apt-get install default-jre -y

How to create your new image

Exit the running container with the exit command and then commit the changes to the running container with:

podman commit ubuntu-dev

Next we need to find the id of the image with:

podman images

You should now see an image labeled listed under REPOSITORY. This image should also have an associated ID, which will be a random string. Copy this string and then tag the image with a new name like this:

podman tag ID ubuntu-dev-base

Where ID is the image ID.

You can name the new image anything you like. Now when you issue the podman images command, you should see your newly tagged image listed as follows:

localhost/ubuntu-dev-base  latest      4bdac71c4932  2 minutes ago           563 MB

If you want to deploy a container based on this new image, the command might look like this:

podman create --name ubuntu-web ubuntu-dev-base

And that’s all you need to create a custom image for your Podman deployments.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for the latest tech advice for business professionals from Jack Wallen.

Leave a Reply

Your email address will not be published. Required fields are marked *