WordPress + MySQL
A straightforward WordPress stack using the official Apache-based WordPress image backed by MySQL 8.0 for database storage and phpMyAdmin for visual database management. Unlike the production stack that uses MariaDB, Nginx, and Redis, this setup is optimized for simplicity and quick deployment. WordPress is exposed on port 8080, phpMyAdmin on port 8081, and MySQL is internal-only on the backend network. All services include health checks and resource limits, with named volumes ensuring data persistence across restarts. Ideal for development environments, small blogs, and getting started with WordPress quickly.
Included Services
wordpress
wordpress:6.7-apache
Environment Variables:
mysql
mysql:8.0
Environment Variables:
phpmyadmin
phpmyadmin:5.2-apache
Environment Variables:
Generated YAML
# Generated by ComposeHub (composehub.dev)
name: wordpress-mysql
services:
wordpress:
image: wordpress:6.7-apache
restart: unless-stopped
ports:
- 8080:80
volumes:
- wordpress_data:/var/www/html
environment:
WORDPRESS_DB_HOST: mysql:3306
WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME:-wordpress}
WORDPRESS_DB_USER: ${WORDPRESS_DB_USER:-wordpress}
WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD:-changeme}
WORDPRESS_TABLE_PREFIX: ${WORDPRESS_TABLE_PREFIX:-wp_}
WORDPRESS_DEBUG: ${WORDPRESS_DEBUG:-false}
networks:
- frontend
- backend
depends_on:
mysql:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- curl -f http://localhost:80/ || exit 1
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.25"
memory: 128M
labels:
com.composeforge.description: WordPress CMS with Apache web server
mysql:
image: mysql:8.0
restart: unless-stopped
command:
- "--default-authentication-plugin=caching_sha2_password"
- "--innodb-buffer-pool-size=256M"
- "--innodb-log-file-size=64M"
- "--innodb-flush-method=O_DIRECT"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
- "--max-connections=100"
volumes:
- mysql_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootchangeme}
MYSQL_DATABASE: ${WORDPRESS_DB_NAME:-wordpress}
MYSQL_USER: ${WORDPRESS_DB_USER:-wordpress}
MYSQL_PASSWORD: ${WORDPRESS_DB_PASSWORD:-changeme}
networks:
- backend
healthcheck:
test:
- CMD
- mysqladmin
- ping
- "-h"
- localhost
- "-u"
- root
- "-p${MYSQL_ROOT_PASSWORD:-rootchangeme}"
interval: 15s
timeout: 5s
retries: 5
start_period: 60s
deploy:
resources:
limits:
cpus: "1.00"
memory: 512M
reservations:
cpus: "0.25"
memory: 256M
labels:
com.composeforge.description: MySQL 8.0 database for WordPress
phpmyadmin:
image: phpmyadmin:5.2-apache
restart: unless-stopped
ports:
- 8081:80
environment:
PMA_HOST: mysql
PMA_PORT: "3306"
PMA_ARBITRARY: ${PMA_ARBITRARY:-0}
UPLOAD_LIMIT: ${PMA_UPLOAD_LIMIT:-64M}
networks:
- frontend
- backend
depends_on:
mysql:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- curl -f http://localhost:80/ || exit 1
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
deploy:
resources:
limits:
cpus: "0.50"
memory: 256M
reservations:
cpus: "0.10"
memory: 64M
labels:
com.composeforge.description: phpMyAdmin web-based MySQL administration
networks:
frontend:
driver: bridge
backend:
driver: bridge
volumes:
wordpress_data:
driver: local
mysql_data:
driver: local
Quick Info
- Services
- 3
- Networks
- 2
- Volumes
- 2
When to Use
This template is ideal for setting up a wordpress + mysql environment. All services are pre-configured with healthchecks, resource limits, and sensible defaults. Customize environment variables before deploying to production.
Tips
- Change all default passwords before deploying
- Review resource limits for your hardware
- Add a reverse proxy for production HTTPS
- Configure backup strategies for data volumes