Podman Pods and WordPress
podmanpodswordpressmariadb
A Podman pod groups containers that share a network namespace. Unlike the named-network example in Podman Multi-Container Web and Database Stacks, containers in the same pod can reach each other through localhost and the container port.
Create the pod and data volume
podman pod create --name wordpress-pod --publish 8080:80
podman volume create wordpress-db
Start MariaDB
podman run --name wordpress-db --pod wordpress-pod --detach \
--volume wordpress-db:/var/lib/mysql \
--env MARIADB_DATABASE=wordpress \
--env MARIADB_USER=wordpress \
--env MARIADB_PASSWORD=change-me-now \
--env MARIADB_ROOT_PASSWORD=change-root-password \
docker.io/library/mariadb:11
Start WordPress
podman run --name wordpress --pod wordpress-pod --detach \
--env WORDPRESS_DB_HOST=127.0.0.1:3306 \
--env WORDPRESS_DB_USER=wordpress \
--env WORDPRESS_DB_PASSWORD=change-me-now \
--env WORDPRESS_DB_NAME=wordpress \
docker.io/library/wordpress:php8.3-apache
The pod publishes port 8080 once, so open http://127.0.0.1:8080. Do not add a second publish option to the individual containers for the same service.
Verify and clean up
podman pod ps
podman pod inspect wordpress-pod
podman logs wordpress-db
podman logs wordpress
Keep the database volume when recreating containers. Remove it only when intentionally deleting the WordPress data.