After setting up the host with Ubuntu 24.04 and Podman, the next logical step is architecture. In the Docker world, you’d usually reach for Docker Compose. But since we are using Podman, we have access to a much more powerful abstraction: Pods.
What is a Pod?
Borrowed from the Kubernetes ecosystem, a Pod is a group of one or more containers that share the same network stack, storage, and IPC. For our WordPress stack, this means the WordPress container can talk to MariaDB via localhost. No complex Docker networks, no internal DNS resolution issues.
Step 1: Creating the Pod
First, we create the shell that will hold our containers. We expose port 8080 (which will be picked up by our Cloudflare Tunnel later).
podman pod create --name wp-stack -p 8080:80
Step 2: Adding MariaDB to the Pod
We deploy MariaDB inside the pod. Note the absence of port mapping here; it’s protected inside the pod’s network boundary.
podman run -d --pod wp-stack \ --name wp-db \ -e MYSQL_ROOT_PASSWORD=your_secure_password \ -e MYSQL_DATABASE=wordpress \ -e MYSQL_USER=wp_user \ -e MYSQL_PASSWORD=your_wp_password \ -v /data/mariadb:/var/lib/mysql:Z \ mariadb:11.8
Step 3: Deploying WordPress
Now, we add the WordPress container. Because they share the same pod, WordPress connects to the database using 127.0.0.1.
podman run -d --pod wp-stack \ --name wp-app \ -e WORDPRESS_DB_HOST=127.0.0.1 \ -e WORDPRESS_DB_USER=wp_user \ -e WORDPRESS_DB_PASSWORD=your_wp_password \ -e WORDPRESS_DB_NAME=wordpress \ -v /data/wordpress:/var/www/html:Z \ wordpress:latest
Why this matters
- Simplicity: No need to manage container links or custom bridges.
- Security: The database isn’t exposed to the host network at all.
- K8s Readiness: Podman can export this setup into a Kubernetes YAML manifest with one command (
podman generate cube), making migration to a real cluster trivial.
Our stack is now running locally on port 8080. In the next post, we will see how to expose this safely to the world without opening a single port on our router using Cloudflare Tunnels.
Exit Code 0. Success.