Managing Pods Using Podman on RHEL

1 hour
  • 4 Learning Objectives

About this Hands-on Lab

Unlike Docker’s single-container concept, Podman brings the ability to run multiple containers in a pod. In this lab, we will examine how to manage multiple containers as part of a pod. Upon completion of this lab, you will be able to use Podman to manage pods.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Run a Rootless Pod

Perform the following tasks as a non-root user:

  • Check for existing rootless containers and pods.
  • Create a pod named wp-pod, with port 80 in the pod published to 8080 on the host.
  • Check again for pods and containers, and confirm that you see an Infra container.
  • Start the mariadb container:
    • Name the container wp-db
    • Add the container to the wp-pod pod
    • Set --restart=always
    • Use the mariadb short name for the container image
    • Set the following environment variables:
    • MYSQL_ROOT_PASSWORD="dbpass"
    • MYSQL_DATABASE="wp"
    • MYSQL_USER="wordpress"
    • MYSQL_PASSWORD="wppass"
  • Check for containers again, and confirm that you see the mariadb container.
  • Start the WordPress container:
    • Name the container wp-web
    • Add the container to the wp-pod pod
    • Set --restart=always
    • Use the wordpress short name for the container image
    • Set the following environment variables:
    • WORDPRESS_DB_NAME="wp"
    • WORDPRESS_DB_USER="wordpress"
    • WORDPRESS_DB_PASSWORD="wppass"
    • WORDPRESS_DB_HOST="127.0.0.1"
  • Check for containers again, and confirm that you see the WordPress container.
  • Check connectivity with a curl command on localhost:8080. Since nothing is returned, immediately check the exit code and confirm it is 0.
  • In a web browser, connect to the lab server’s public IP address or DNS name on port 8080 and confirm that the WordPress page is functional.
Run a Rootfull Pod

Perform the following tasks as the root user:

  • Become the root user.
  • Check for existing rootfull containers and pods.
  • Create a pod named root-wp-pod, with port 80 in the pod published to 8081 on the host.
  • Check again for pods and containers, and confirm that you see an Infra container.
  • Start the mariadb container:
    • Name the container root-wp-db
    • Add the container to the root-wp-pod pod
    • Set --restart=always
    • Use the mariadb short name for the container image
    • Set the following environment variables:
    • MYSQL_ROOT_PASSWORD="dbpass"
    • MYSQL_DATABASE="wp"
    • MYSQL_USER="wordpress"
    • MYSQL_PASSWORD="wppass"
  • Check for containers again, and confirm that you see the mariadb container.
  • Start the WordPress container:
    • Name the container root-wp-web
    • Add the container to the root-wp-pod pod
    • Set --restart=always
    • Use the wordpress short name for the container image
    • Set the following environment variables:
    • WORDPRESS_DB_NAME="wp"
    • WORDPRESS_DB_USER="wordpress"
    • WORDPRESS_DB_PASSWORD="wppass"
    • WORDPRESS_DB_HOST="127.0.0.1"
  • Check for containers again, and confirm that you see the WordPress container.
  • Check connectivity with a curl command on localhost:8081. Since nothing is returned, immediately check the exit code and confirm it is 0.
  • In a web browser, connect to the lab server’s public IP address or DNS name on port 8081 and confirm that the WordPress page is functional.
Manage a Rootless Pod

Perform the following tasks as a non-root user:

  • Check for any containers and pods that are running, which should include the wp-pod pod and its containers.
  • Stop the wp-pod pod, along with its containers.
  • Check the pods and containers again, and confirm that they have been stopped.
  • Start the wp-pod pod, along with all its containers.
  • Check the pods and containers again, and confirm that they have been started.
  • Restart the wp-pod pod, along with all its containers.
  • Check the pods and containers again, and confirm that they have been restarted.
  • Get information about the wp-pod pod.
  • List the wp-pod pod’s processes.
  • Kill and remove the wp-pod pod and its containers.
  • Check the pods and containers again, and confirm that they have been removed.
  • Clean up any reclaimable space using podman system commands, and confirm it has been cleaned up.
Manage a Rootfull Pod

Perform the following tasks as the root user:

  • Become the root user.
  • Check for any containers and pods that are running, which should include the root-wp-pod pod and its containers.
  • Pause the root-wp-pod pod, along with its containers.
  • Check the pods and containers again, and confirm that they have been paused.
  • Unpause the root-wp-pod pod.
  • Check the pods and containers again, and confirm that they have been unpaused.
  • Pull performance statistics for the root-wp-pod pod and its containers.
  • Stop the root-wp-pod pod.
  • Clean up any reclaimable space using podman system and podman pod commands, and confirm it has been cleaned up.

Additional Resources

Let's build some WordPress pods!

In order to explore managing pods with Podman, we're going to stand up one rootless WordPress pod and one rootfull WordPress pod. We'll take a look at the most common podman pod operations used to manage Podman pods, and get hands-on practice doing it.

Let's go!

When the lab starts, open an SSH connection to your lab instance, replacing PUBLIC_IP_ADDRESS with either the Public IP or DNS hostname 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.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

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