Page:
wordpress
No results
1
wordpress
Luca Matteo Spoljarevic edited this page 2026-02-27 21:45:51 +01:00
WordPress
This setup runs WordPress and MariaDB with Podman Compose. WordPress is served on a configurable port and uses a .env file for database and credentials.
What the compose file does
Service: wordpress
- Image:
docker.io/library/wordpress:latest - Port:
8040→ container80 - Config:
env_file: .envand environment variables for DB host, user, password, and database name - Role: Web server and PHP app; connects to the
dbservice
Service: db
- Image:
docker.io/library/mariadb:10.6.4-focal - Command: Uses
mysql_native_passwordfor compatibility with WordPress - Volume: Named volume
db_datafor/var/lib/mysql - Config:
env_file: .env— root password, database name, and user/password (must match WordPress vars)
Volume
- db_data — persists MariaDB data across restarts
Environment file
The stack expects a .env file in the same directory as podman-compose.yml. Use env.example as a template:
# WordPress → MariaDB
WORDPRESS_DB_HOST=db
WORDPRESS_DB_USER=wordpress
WORDPRESS_DB_PASSWORD=SuperSecret!
WORDPRESS_DB_NAME=wordpress
# MariaDB
MYSQL_ROOT_PASSWORD=RootPass123!
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=SuperSecret!
Important: Use strong, unique passwords in production and do not commit .env to version control.
Prerequisites
- Podman and Podman Compose installed
- Copy
env.exampleto.envand set your passwords (and optionally DB name/user).
How to use
-
Go to the project folder:
cd wordpress -
Create
.env:cp env.example .envEdit
.envand set strong values forWORDPRESS_DB_PASSWORD,MYSQL_ROOT_PASSWORD, andMYSQL_PASSWORD. -
Start the stack:
podman-compose up -d -
Open WordPress:
http://<your-host>:8040
Complete the famous “5-minute” WordPress installation (site title, admin user, etc.). -
Stop:
podman-compose down
Database data is stored in the db_data volume, so it persists across down/up.
Useful commands
| Action | Command |
|---|---|
| Start | podman-compose up -d |
| Stop | podman-compose down |
| Logs | podman-compose logs -f |
| Restart | podman-compose restart |
Customization
- Change the host port by editing
8040:80underwordpress→ports. - To use different DB credentials or database name, update both the
WORDPRESS_*andMYSQL_*entries in.envso they stay in sync.