This directory contains ready-to-use Docker Compose configurations demonstrating various ways to use the Displace Technologies Container Library.
A full-featured WordPress installation with MariaDB, optimized for production use.
Features:
- WordPress 6.8.3 with PHP 8.4 and Apache
- MariaDB 11.5 database
- Auto-installation option
- Health checks and logging
- Persistent volumes
Usage:
# Start the stack
docker compose -f examples/wordpress-complete.yml up -d
# View logs
docker compose -f examples/wordpress-complete.yml logs -f
# Stop the stack
docker compose -f examples/wordpress-complete.yml downAccess:
- WordPress site: http://localhost:8080
- Admin credentials: admin/change_this_password (if auto-install enabled)
A development-friendly WordPress setup with debugging and development tools.
Features:
- WordPress 6.8.3 with PHP 8.3 (stable for development)
- Debug logging enabled
- PHPMyAdmin for database management
- Volume mounts for local development
- Database port exposed for external tools
Usage:
# Create development directories
mkdir -p wp-content uploads logs/apache logs/mariadb logs/wordpress dev-db-init
# Start the development stack
docker compose -f examples/wordpress-development.yml up -d
# Access services
echo "WordPress: http://localhost:8080"
echo "PHPMyAdmin: http://localhost:8081"
echo "Database: localhost:3306 (user: developer, pass: devpass123)"Development Workflow:
- Edit themes/plugins in
./wp-content/ - Monitor logs in
./logs/ - Use PHPMyAdmin for database operations
- Connect external tools to exposed database port
Demonstrates using individual containers as separate microservices.
Features:
- Apache web server
- PHP-FPM 8.4 application server
- MariaDB database
- Redis cache (optional)
- Network segmentation
Usage:
# Create required directories
mkdir -p html apache-config php-config db-init
# Add a simple PHP file
echo '<?php phpinfo(); ?>' > html/index.php
# Start services
docker compose -f examples/separate-services.yml up -dAccess:
- Web application: http://localhost:8080
- Docker and Docker Compose installed
- Ports 8080, 8081, and 3306 available (modify as needed)
-
Choose an example based on your needs:
- Production WordPress:
wordpress-complete.yml - Development setup:
wordpress-development.yml - Microservices:
separate-services.yml
- Production WordPress:
-
Start the stack:
docker compose -f examples/<example-name>.yml up -d
-
Check status:
docker compose -f examples/<example-name>.yml ps
-
View logs:
docker compose -f examples/<example-name>.yml logs -f
-
Stop when done:
docker compose -f examples/<example-name>.yml down
Create a .env file to override default values:
# .env file example
MYSQL_ROOT_PASSWORD=my_secure_root_password
WORDPRESS_ADMIN_PASSWORD=my_admin_password
WORDPRESS_DB_PASSWORD=my_db_passwordThen reference in docker-compose.yml:
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-default_password}For persistent data in production:
volumes:
wordpress_data:
driver: local
driver_opts:
type: none
device: /opt/wordpress-data
o: bindFor external database connections:
services:
wordpress:
environment:
WORDPRESS_DB_HOST: external-db.example.com:3306
WORDPRESS_DB_NAME: prod_wordpress
WORDPRESS_DB_USER: wp_prod_user
WORDPRESS_DB_PASSWORD: secure_prod_password-
Change default passwords in all examples
-
Use secrets management for sensitive data:
services: mariadb: environment: MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root_password secrets: - mysql_root_password secrets: mysql_root_password: file: ./secrets/mysql_root_password.txt
-
Enable SSL/TLS for production deployments
-
Restrict network access using Docker networks
-
Resource limits:
services: wordpress: deploy: resources: limits: cpus: '1.0' memory: 512M
-
Database tuning:
mariadb: command: --innodb-buffer-pool-size=512M --max-connections=200
-
Enable caching (Redis, Memcached, etc.)
Add monitoring services:
services:
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"-
Port conflicts:
# Check what's using the port lsof -i :8080 # Change port in docker-compose.yml ports: - "8081:8080" # Use 8081 instead
-
Permission errors:
# Fix file permissions sudo chown -R $USER:$USER ./wp-content
-
Database connection issues:
# Check database container logs docker compose logs mariadb # Test database connection docker compose exec wordpress nc -z mariadb 3306
-
Container startup failures:
# Check container logs docker compose logs <service_name> # Check container health docker compose ps
Enable debug logging in WordPress:
services:
wordpress:
environment:
WORDPRESS_DEBUG: "true"
WORDPRESS_DEBUG_LOG: "true"Then check logs:
docker compose exec wordpress tail -f /var/www/html/wp-content/debug.logUse different configurations for different environments:
# Development
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
# Production
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -dAdd multiple WordPress instances with a load balancer:
services:
nginx:
image: nginx:alpine
ports:
- "80:80"
depends_on:
- wordpress1
- wordpress2
wordpress1:
image: ghcr.io/displacetech/wordpress:6.8.3-php8.4
# ... config
wordpress2:
image: ghcr.io/displacetech/wordpress:6.8.3-php8.4
# ... configFor issues or questions:
- Check the main project documentation
- Review container-specific documentation in
containers/ - Open an issue on GitHub
- Check Docker and Docker Compose logs for errors
To add new examples:
- Create a new
.ymlfile following the naming convention - Include comprehensive comments and documentation
- Test thoroughly in different environments
- Update this README with the new example
- Submit a pull request