Skip to content

Instantly share code, notes, and snippets.

@pjaudiomv
Created June 21, 2026 02:04
Show Gist options
  • Select an option

  • Save pjaudiomv/8475590b033374e030e2429e611f78b4 to your computer and use it in GitHub Desktop.

Select an option

Save pjaudiomv/8475590b033374e030e2429e611f78b4 to your computer and use it in GitHub Desktop.
WordPress Docker Compose
services:
wordpress:
depends_on:
- db
build: .
restart: always
ports:
- 8080:80
- 7443:443
environment:
WORDPRESS_DEBUG: true
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
WP_HOME: http://localhost:8080
WP_SITEURL: http://localhost:8080
volumes:
# Mount the entire public_html directory as the WordPress root
- ./site:/var/www/html
# Separate logs directory
- ./logs/:/var/log/apache2
db:
image: mariadb:10.11
restart: always
ports:
- 3306:3306
environment:
MARIADB_ROOT_PASSWORD: somewordpress
MARIADB_DATABASE: wordpress
MARIADB_USER: wordpress
MARIADB_PASSWORD: wordpress
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/001-init.sql
- db_data:/var/lib/mysql
volumes:
db_data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment