DEV Community

Cover image for Building Multi-Container Applications using Podman Quadlets
Project-42
Project-42

Posted on

Building Multi-Container Applications using Podman Quadlets

A perfect practical application for Quadlets is deploying a WordPress stack.
This illustrates how multiple containers can communicate with each other.

1. Common Network (wp.network)

Create a quadlet network file at ~/.config/containers/systemd/wp.network

[|=| raspi in ~/pods/wordpress ]$ cat ~/.config/containers/systemd/wp.network
[Network]
Label=app=wordpress

[|=| raspi in ~/pods/wordpress ]$
Enter fullscreen mode Exit fullscreen mode

2. The mariadb Container (mariadb.container)

Create a quadlet container file at ~/.config/containers/systemd/

[|=| raspi in ~/pods/wordpress ]$ cat ~/.config/containers/systemd/mariadb.container
[Unit]
Description=MariaDB WordPress Database

[Container]
ContainerName=mariadb
Image=docker.io/library/mariadb:latest
# Quadlet likes environment variables on one line or using a separate env file
Environment=MYSQL_ROOT_PASSWORD=wordpress MYSQL_DATABASE=wordpress MYSQL_USER=wordpress MYSQL_PASSWORD=wordpress
Exec=--default-authentication-plugin=mysql_native_password
Volume=/home/solifugo/pods/wordpress/db_data:/var/lib/mysql
Network=wp.network
PublishPort=3306:3306

[Service]
Restart=always

[Install]
WantedBy=wordpress.service multi-user.target default.target

[|=| raspi in ~/pods/wordpress ]$
Enter fullscreen mode Exit fullscreen mode

3. The WordPress Container (wordpress.container)

Create a quadlet container file at ~/.config/containers/systemd/

[|=| raspi in ~/pods/wordpress ]$ cat ~/.config/containers/systemd/wordpress.container
[Unit]
Description=WordPress Web Server
After=mariadb.service

[Container]
Image=docker.io/library/wordpress:latest
Environment=WORDPRESS_DB_HOST=mariadb:3306 WORDPRESS_DB_USER=wordpress WORDPRESS_DB_PASSWORD=wordpress WORDPRESS_DB_NAME=wordpress
Volume=/home/solifugo/pods/wordpress/wp-content:/var/www/html/wp-content
PublishPort=8042:80
Network=wp.network

[Service]
Restart=always

[Install]
WantedBy=multi-user.target default.target

[|=| raspi in ~/pods/wordpress ]$
Enter fullscreen mode Exit fullscreen mode

4. Key Adjustments Made

  • Networking: In Podman, containers in the same default network can talk to each other using their filenames as hostnames.
    I set WORDPRESS_DB_HOST=mariadb to match the mariadb.container filename.

  • Dependencies: The After=mariadb.service line in the WordPress file ensures the database attempts to start before the web server.

5. How to Start It

Once the files are in ~/.config/containers/systemd/, run the following commands:

Reload systemd to generate the services and start the service

[|=| raspi in ~/pods/wordpress ]$ systemctl --user daemon-reload

[|=| raspi in ~/pods/wordpress ]$ systemctl --user list-unit-files |grep -E 'word|mari'
mariadb.service                                generated -
wordpress.service                              generated -

[|=| raspi in ~/pods/wordpress ]$

[|=| raspi in ~/pods/wordpress ]$ systemctl --user start wordpress.service

[|=| raspi in ~/pods/wordpress ]$ systemctl --user status wordpress.service
● wordpress.service - WordPress Web Server
     Loaded: loaded (/home/solifugo/.config/containers/systemd/wordpress.container; generated)
     Active: active (running) since Fri 2026-02-13 12:30:18 GMT; 3 days ago
 Invocation: b544331ed44d4d1f8092e71265ab7783
   Main PID: 1511243 (conmon)
      Tasks: 23 (limit: 8750)
        CPU: 20.699s
[...]
[|=| raspi in ~/pods/wordpress ]$
Enter fullscreen mode Exit fullscreen mode

And voila! we got our wordpress installation ready

Wordpress running in Podman

Top comments (0)