Building and Running Containers
Master building custom container images and running containers with Podman, including managing port mappings and running interactive containers.
About This Lab
In this hands-on lab, you will learn how to build custom container images, run containers from those images, and manage them using Podman. Podman is a powerful, daemon-less container engine that provides an alternative to Docker, allowing you to create and manage containers with greater flexibility and security. This lab will guide you through the process of creating custom images, running containers, and verifying your containerized applications.
What You Will Learn
This lab will guide you through:
- Installing Podman using the
dnf
package manager and verifying the installation. - Creating a custom container image using a
Dockerfile
and adding dependencies like Python and curl. - Writing a custom entry point script for your container.
- Building the custom image using the
podman build
command and running containers from the custom image. - Running containers in both detached and interactive modes.
- Accessing a running container to install additional tools and verify its functionality.
- Exposing containerized services to the host machine using port mapping.
Why Learn Podman for Container Management?
As containers continue to play a significant role in modern application development and deployment, learning how to build and manage containers is an essential skill for system administrators, developers, and DevOps engineers. Podman offers a lightweight, secure alternative to Docker, with the added benefit of being daemon-less. This allows greater flexibility and control over your containers without requiring a central service. Understanding how to build custom images and manage containers with Podman is crucial for anyone involved in containerization, whether on a local machine or in production environments.
Who Should Take This Lab?
This lab is ideal for:
- Beginners who want to learn about building and running containers with Podman.
- Linux system administrators looking to manage containers in a secure, daemon-less environment.
- Developers and DevOps professionals wanting to deepen their understanding of containerized application workflows.
- Students preparing for certifications like Red Hat Certified System Administrator.
Prerequisites
Before starting this lab, ensure you have:
- Basic knowledge of Linux command-line operations.
Lab Highlights
Key steps you will perform in this lab include:
- Installing Podman and verifying the installation.
- Creating a custom
Dockerfile
to define a container image with dependencies and a custom entry point script. - Building and tagging the custom image using the
podman build
command. - Running the custom container image and interacting with it using Podman commands.
- Running an
httpd
container in detached mode, exposing it to the host machine via port mapping. - Verifying the functionality of the containerized web server from both inside and outside the container.
This lab will give you hands-on experience with Podman’s container lifecycle, including image building, running containers, and managing ports, all of which are critical for working in modern cloud-native environments.