Container - SS67/project-docs GitHub Wiki
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.
On all VMs, ensure Podman is installed. Use sudo yum install podman on RHEL and sudo apt install podman on Ubuntu.
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 usepodman inspectto find its IP. -
Advanced Challenge: Build a custom web image using a
Containerfile. Usepodman build --tag myimage ./contextand push it to a local registry or Quay.io.
- Practice: Pull
-
Lab 2: Volumes (Ch 3)
- Practice: Mount a local directory into
/var/www/htmlusing-v. On RHEL, practice using:Zto fix SELinux permission errors. -
Advanced Challenge: Use the
:Uoption to automatically change host volume ownership to match a non-root container user (likemysqlorapache).
- Practice: Mount a local directory into
-
Lab 3: Pods (Ch 4)
- Practice: Create a pod named
webstackand add two containers: a web server and a "sidecar" script that updates the index file. -
Advanced Challenge: Verify that both containers can communicate via
localhostwithin the pod because they share a network namespace.
- Practice: Create a pod named
Objective: Understand how Podman is configured and how it operates without root.
-
Lab 4: Configuration Files (Ch 5)
- Practice: Modify
/etc/containers/registries.confto blockdocker.ioand prioritizequay.io. -
Advanced Challenge: Create a custom
containers.confto set a default environment variable (e.g.,APP_ENV=dev) for every container you run.
- Practice: Modify
-
Lab 5: Rootless Mechanics (Ch 6)
- Practice: Use
podman unshare cat /proc/self/uid_mapto see how your user UID is mapped to root inside the container. -
Advanced Challenge: Manually mount an image's filesystem using
podman image mountinside apodman unsharesession to inspect files without running the container.
- Practice: Use
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.serviceto turn it into a user service. -
Advanced Challenge: Set up auto-updates. Add the label
io.containers.autoupdate=registryto a container, push a new version of the image to the registry, and runpodman auto-update.
- Practice: Run a container and then use
-
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.yamlto recreate the entire environment (volumes, pods, and containers) from that one file.
- Practice: Take a running pod and use
-
Lab 8: Podman as a Service (Ch 9)
- Practice: Enable the Podman socket (
systemctl --user enable --now podman.socket) and usecurlto query the version via the REST API. -
Advanced Challenge (Cross-VM): On your RHEL VM, use
podman --remoteto manage containers running on your Ubuntu VM via SSH.
- Practice: Enable the Podman socket (
Objective: Dig into the kernel features that provide isolation.
-
Lab 9: Isolation & Capabilities (Ch 10)
- Practice: Run a container with
--cap-drop=alland try to perform tasks to see which ones fail. Then, add onlyCAP_NET_RAWto allowping. -
Advanced Challenge: Use
--userns=autoon your RHEL VM to launch containers where each gets a unique, non-overlapping range of UIDs.
- Practice: Run a container with
-
Lab 10: Additional Security (Ch 11)
- Practice: Use
podman secret createto 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 inpolicy.jsonto reject any unsigned images from that registry.
- Practice: Use
| 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. |