- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
Managing Pods Using Podman on RHEL
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.
Lab Info
Table of Contents
-
Challenge
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 port80in the pod published to8080on the host. - Check again for pods and containers, and confirm that you see an Infra container.
- Start the
mariadbcontainer:- Name the container
wp-db - Add the container to the
wp-podpod - Set
--restart=always - Use the
mariadbshort name for the container image - Set the following environment variables:
- MYSQL_ROOT_PASSWORD="dbpass"
- MYSQL_DATABASE="wp"
- MYSQL_USER="wordpress"
- MYSQL_PASSWORD="wppass"
- Name the container
- Check for containers again, and confirm that you see the
mariadbcontainer. - Start the WordPress container:
- Name the container
wp-web - Add the container to the
wp-podpod - Set
--restart=always - Use the
wordpressshort 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"
- Name the container
- Check for containers again, and confirm that you see the Wordpress container.
- Check connectivity with a
curlcommand onlocalhost:8080. Since nothing is returned, immediately check the exit code and confirm it is0. - 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.
-
Challenge
Run a Rootfull Pod
Perform the following tasks as the root user:
- Become the
rootuser. - Check for existing rootfull containers and pods.
- Create a pod named
root-wp-pod, with port80in the pod published to8081on the host. - Check again for pods and containers, and confirm that you see an Infra container.
- Start the
mariadbcontainer:- Name the container
root-wp-db - Add the container to the
root-wp-podpod - Set
--restart=always - Use the
mariadbshort name for the container image - Set the following environment variables:
- MYSQL_ROOT_PASSWORD="dbpass"
- MYSQL_DATABASE="wp"
- MYSQL_USER="wordpress"
- MYSQL_PASSWORD="wppass"
- Name the container
- Check for containers again, and confirm that you see the
mariadbcontainer. - Start the WordPress container:
- Name the container
root-wp-web - Add the container to the
root-wp-podpod - Set
--restart=always - Use the
wordpressshort 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"
- Name the container
- Check for containers again, and confirm that you see the Wordpress container.
- Check connectivity with a
curlcommand onlocalhost:8081. Since nothing is returned, immediately check the exit code and confirm it is0. - 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.
- Become the
-
Challenge
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-podpod and its containers. - Stop the
wp-podpod, along with its containers. - Check the pods and containers again, and confirm that they have been stopped.
- Start the
wp-podpod, along with all its containers. - Check the pods and containers again, and confirm that they have been started.
- Restart the
wp-podpod, along with all its containers. - Check the pods and containers again, and confirm that they have been restarted.
- Get information about the
wp-podpod. - List the
wp-podpod's processes. - Kill and remove the
wp-podpod and its containers. - Check the pods and containers again, and confirm that they have been removed.
- Clean up any reclaimable space using
podman systemcommands, and confirm it has been cleaned up.
- Check for any containers and pods that are running, which should include the
-
Challenge
Manage a Rootfull Pod
Perform the following tasks as the root user:
- Become the
rootuser. - Check for any containers and pods that are running, which should include the
root-wp-podpod and its containers. - Pause the
root-wp-podpod, along with its containers. - Check the pods and containers again, and confirm that they have been paused.
- Unpause the
root-wp-podpod. - Check the pods and containers again, and confirm that they have been unpaused.
- Pull performance statistics for the
root-wp-podpod and its containers. - Stop the
root-wp-podpod. - Clean up any reclaimable space using
podman systemandpodman podcommands, and confirm it has been cleaned up.
- Become the
About the author
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.