Skip to content

Container

Sujay Singh edited this page Aug 3, 2026 · 1 revision

This lab is designed to take you through the entire journey of the source material, from basic container interaction to advanced production-level security and orchestration. Since you have a vSphere environment with RHEL 9, RHEL 10, and Ubuntu 24 VMs, you can leverage their differences—specifically how RHEL handles SELinux and how Ubuntu provides a different comparison for security defaults.

Initial Setup: Preparation

On all VMs, ensure Podman is installed. Use sudo yum install podman on RHEL and sudo apt install podman on Ubuntu.


Module 1: Foundations (Chapters 2–4)

Objective: Master the CLI, data persistence, and the "Pod" concept.

  • Lab 1: CLI & Image Management (Ch 2)
    • Practice: Pull ubi8/httpd-24, run it in detached mode with port 8080 mapped, and use podman inspect to find its IP.
    • Advanced Challenge: Build a custom web image using a Containerfile. Use podman build --tag myimage ./context and push it to a local registry or Quay.io.
  • Lab 2: Volumes (Ch 3)
    • Practice: Mount a local directory into /var/www/html using -v. On RHEL, practice using :Z to fix SELinux permission errors.
    • Advanced Challenge: Use the :U option to automatically change host volume ownership to match a non-root container user (like mysql or apache).
  • Lab 3: Pods (Ch 4)
    • Practice: Create a pod named webstack and add two containers: a web server and a "sidecar" script that updates the index file.
    • Advanced Challenge: Verify that both containers can communicate via localhost within the pod because they share a network namespace.

Module 2: Customization & Rootless Internals (Chapters 5–6)

Objective: Understand how Podman is configured and how it operates without root.

  • Lab 4: Configuration Files (Ch 5)
    • Practice: Modify /etc/containers/registries.conf to block docker.io and prioritize quay.io.
    • Advanced Challenge: Create a custom containers.conf to set a default environment variable (e.g., APP_ENV=dev) for every container you run.
  • Lab 5: Rootless Mechanics (Ch 6)
    • Practice: Use podman unshare cat /proc/self/uid_map to see how your user UID is mapped to root inside the container.
    • Advanced Challenge: Manually mount an image's filesystem using podman image mount inside a podman unshare session to inspect files without running the container.

Module 3: Advanced Topics & Integration (Chapters 7–9)

Objective: Productionize containers using systemd and Kubernetes standards.

  • Lab 6: Systemd Integration (Ch 7)
    • Practice: Run a container and then use podman generate systemd --new --name myapp > ~/.config/systemd/user/myapp.service to turn it into a user service.
    • Advanced Challenge: Set up auto-updates. Add the label io.containers.autoupdate=registry to a container, push a new version of the image to the registry, and run podman auto-update.
  • Lab 7: Working with Kubernetes (Ch 8)
    • Practice: Take a running pod and use podman generate kube mypod > mypod.yaml.
    • Advanced Challenge: Delete everything and use podman play kube mypod.yaml to recreate the entire environment (volumes, pods, and containers) from that one file.
  • Lab 8: Podman as a Service (Ch 9)
    • Practice: Enable the Podman socket (systemctl --user enable --now podman.socket) and use curl to query the version via the REST API.
    • Advanced Challenge (Cross-VM): On your RHEL VM, use podman --remote to manage containers running on your Ubuntu VM via SSH.

Module 4: Security Hardening (Chapters 10–11)

Objective: Dig into the kernel features that provide isolation.

  • Lab 9: Isolation & Capabilities (Ch 10)
    • Practice: Run a container with --cap-drop=all and try to perform tasks to see which ones fail. Then, add only CAP_NET_RAW to allow ping.
    • Advanced Challenge: Use --userns=auto on your RHEL VM to launch containers where each gets a unique, non-overlapping range of UIDs.
  • Lab 10: Additional Security (Ch 11)
    • Practice: Use podman secret create to pass sensitive data to a container without it being committed to an image.
    • Advanced Challenge: Practice Image Signing. Generate a GPG key, push an image to Quay.io while signing it (--sign-by), and configure a policy in policy.json to reject any unsigned images from that registry.

Summary of Lab Environment Strategy

Feature Best VM to Practice On Reason
SELinux RHEL 9/10 Essential for practicing :Z mounts and type enforcement.
Rootless Ubuntu 24 Good for seeing Slirp4netns networking defaults without SELinux.
Remote Access Ubuntu (Client) & RHEL (Server) Practice setting up SSH connections between different distros.
systemd RHEL 9 RHEL 9 defaults to crun and has modern systemd features for Podman.

Clone this wiki locally