Advanced Container Management Using Podman on RHEL

1 hour
  • 4 Learning Objectives

About this Hands-on Lab

Let’s take our container skills to the next level! In this lab, we’re going to step up our container management by adding storage, networking, monitoring, and more. Upon completion of this lab, you will be able to perform the foundational container management activities required for day-to-day container management.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Work with Container Storage

You will first work with Podman container storage!

Container Storage Using a Directory
  • Create a directory named ~/html.
  • Create 3 text files in your new ~/html directory:
    • Name these test1.txt, test2.txt, and test3.txt.
    • Make the contents "Test File 1", "Test File 2", and "Test File 3".
  • Start 3 nginx containers:
    • Name them web1, web2, and web3.
    • Attach the ~/html directory to the container at /usr/share/nginx/html/.
  • Run a curl command inside each container to test.
    • Try pulling each of your text files.
  • Stop and remove all 3 containers.
Container Storage Using a Container Volume
  • Create a new container storage volume named webvol.
  • Start 3 nginx containers:
    • Name them web1, web2, and web3.
    • Attach the webvol volume to the container at /usr/share/nginx/html/.
  • Copy the 3 text files from ~/html into the web1 container to the /usr/share/nginx/html/ directory.
  • Run an ls command inside of each container to list the contents of the /usr/share/nginx/html/ directory.
    • You should see the 3 text files.
  • Run a curl command inside each container to test.
    • Try pulling each of your text files.
  • Stop and remove all 3 containers.

You can now proceed to the next objective!

Configure Container Networking

Now you can make your nginx web servers available outside of their containers!

Publish Your Web Servers’ Ports
  • Start 3 nginx containers:
    • Name them web1, web2, and web3.
    • Attach the webvol volume to the container at /usr/share/nginx/html/.
    • Publish the containers’ port 80:
    • 8081 (web1)
    • 8082 (web2)
    • 8083 (web3)
  • Check the published container ports.
  • Run curl commands on your host:
    • Pull the 3 test text files from the 3 web server containers.
  • Stop and remove all 3 containers.

Now you can try setting up some container healthchecks!

Use Container Healthchecks

Now that you have your web server containers up and running with shared storage and networking, add a check that validates that nginx is available.

Configure Healthchecks For Your Web Servers
  • Start 3 nginx containers:
    • Name them web1, web2, and web3.
    • Attach the webvol volume to the container at /usr/share/nginx/html/.
    • Publish the containers’ port 80:
    • 8081 (web1)
    • 8082 (web2)
    • 8083 (web3)
    • Add a healthcheck for each server:
    • ‘curl http://localhost || exit 1’
    • Set the healthcheck interval to 0
  • Run curl commands on your host.
    • Pull the 3 test text files from the 3 web server containers.
  • Run the healthchecks for all 3 servers.
    • Validate that the nginx service is healthy on all 3 servers.

Your containers are looking great now! Now you can take a look at your Podman host.

Manage Your Podman Environment

With healthy containers, check out the host.

Managing Your Podman System
  • Display system information for your Podman host.
  • Display Podman’s disk space utilization.
    • Use regular and verbose modes.
  • Clean up unused data using prune.
  • Display Podman’s disk space utilization again.

All cleaned up!

Monitoring Your Podman System
  • Take a look at events from the last 10 minutes.
  • Display all prune events for the past 15 minutes.

Looks good!

Additional Resources

Let's stand up a mini web farm!

We're going to run a set of 3 nginx containers that will share 3 text files from a shared storage location. We'll make the web server available to the host, and will add a healthcheck for our nginx service on each container. Finally, we will explore using Podman to pull system information and events.

Let's go!

When the lab starts, open an SSH connection to your lab instance. Replace PUBLIC_IP_ADDRESS with either the Public IP or DNS of the instance:

ssh cloud_user@<PUBLIC_IP_ADDRESS>

The cloud_user password has been provided with the credentials and instance information within the hands-on lab.

Good luck and enjoy!

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?