Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Customizing Container Images Using Podman and Buildah on RHEL

An important part of the Podman landscape is container images, and the Podman team have provided Buildah to create those images. In this lab, we will use Buildah to create our own custom container images using both a Dockerfile and native Buildah commands. We will also take a look at some of Buildah’s container image management functionality. Upon completion of this lab, you will be able to use Buildah to create your own custom container images.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 16, 2025
Duration
1h 15m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Create a Container Image Using Buildah and Dockerfile

    We're going to use the following criteria to build a custom container image, using Buildah and a Dockerfile:

    • Based on the fedora:latest container image
    • Maintainer=“[email protected]
    • Install httpd in the container
      • Clean up after install
    • Create five test text files in /var/www/html
      • Contents should be "Test File (1-5)"
      • Filenames should be "test(1-5).txt"
    • Expose port 80
    • Run our httpd service using "/usr/sbin/httpd -D FOREGROUND"
    • Name our image my-fedora-httpd:latest

    Instructions:

    First create a Dockerfile based on the above criteria, then use buildah bud to build a container image from the Dockerfile. Next, launch five containers `my-fedora-httpd-(1-5) and test with curl. Make sure you can retrieve any of the test files (test(1-5).txt) from any of the containers.

    When testing is successful, clean up all your containers and images.

  2. Challenge

    Create a Container Image Using Buildah Native Commands

    We're going to use the following criteria to build a custom container image, using Buildah Native Commands:

    • Based on the fedora:latest container image.
    • Maintainer=[email protected]
    • Install httpd in the container.
      • Clean up after install.
    • Create five test text files in /var/www/html.
      • Contents should be Test File (1-5).
      • Filenames should be test(1-5).txt.
    • Expose port 80.
    • Run our httpd service using "/usr/sbin/httpd -D FOREGROUND".
    • Name our image my-fedora-httpd:latest.

    Instructions:

    Build a container image using the above description using buildah native commnads. Next, launch five containers `my-fedora-httpd-(1-5) and test with curl. Make sure you can retrieve any of the test files (test(1-5).txt) from any of the containers.

  3. Challenge

    Start the Local Container Image Registry

    A local container image registry has been pre-configured on your server. Before we can use it, we need to start it. A script (registry.sh) has been provided in the cloud_user home directory. You will need to run this script with sudo, as it requires root privilages.

  4. Challenge

    Use Buildah to Manage Containers and Images

    Let's explore the ways we can manage containers and images using buildah!

    General Buildah Commands:

    Perform the following:

    • View the help information for the buildah command.
      • View the help information for the buildah help command.
    • View the man page for the buildah command.
    • Display information for the buildah system.
    • Diplay information about the localhost/my-fedora-httpd container image.
    • Check the version of buildah.

    Content Management Using Buildah:

    Perform the following:

    • Create a directory ~/testfiles and add some test files to it using the for i inseq 1 5; do echo "Add Test File "$i > ~/testfiles/add$i.txt ; echo "Copy Test File "$i > ~/testfiles/copy$i.txt ; done command.
      • View the contents of the files to verify them.
    • View the help information for the buildah add and buildah copy commands.
    • Create a new intermediate container using the fedora:latest container image.
    • Use buildah to list its containers.
    • Transfer the files you created into the /var/www/html/ directory of the intermediate container you created.
      • Transfer the add(1-5).txt files using buildah add command.
      • Transfer the copy(1-5).txt files using the buildah copy command.

    Filesystem Management Using Buildah:

    Perform the following:

    • Run your commands using a modified user namespace.
    • Mount the intermediate container's filesystem.
    • Check for our newly transferred files.
      • Use ls.
      • View the contents of the files.
    • Unmount the intermediate container's filesystem.
    • Exit the modified user namespace.

    Image Management Using Buildah:

    Perform the following:

    • List our container images using buildah.
    • Use buildah to log in to our local container registry at https://localhost:5000.
      • Username: cloud_user
      • Password: Enter the password provided by the lab credentials.
    • Push our localhost/my-fedora-httpd:latest container image to the local container registry.
    • Check our work using curl -u cloud_user:registry https://localhost:5000/v2/_catalog.
    • List our local container images using buildah.
    • Remove the localhost/my-fedora-httpd:latest container image from our local storage (not the local container registry!).
    • List our local container images using buildah again.
    • Pull the localhost/my-fedora-httpd:latest container image from the local container registry.
    • List our local container images using buildah again.
    • Add a tag for our my-fedora-httpd:latest image.
      • Make the tag ourcustomwebserver:latest.
    • List our local container images using buildah again.
    • Log out of our local container image registry.

    Container Management Using Buildah:

    Perform the following:

    • Diplay a list of containers using buildah.
    • Use buildah to rename the intermediate working container to my-container.
    • Diplay a list of containers using buildah again.
    • Remove the my-container container using buildah.
    • Diplay a list of containers using buildah again.

    Great work, Cloud Gurus!

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight