Created
June 8, 2019 13:43
-
-
Save jan-koch/659872545d7f60323f8803f5fc66d0c5 to your computer and use it in GitHub Desktop.
Example of a docker-compose file to create a local WordPress development setup with Docker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.2' | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- db_data:/var/lib/mysql | |
restart: on-failure | |
environment: | |
# Grab this data from wp-config.php | |
# TODO: Update DB_HOST in wp-config.php to "db:port" | |
MYSQL_ROOT_PASSWORD: wordpress | |
MYSQL_DATABASE: wordpress | |
MYSQL_USER: wordpress | |
MYSQL_PASSWORD: wordpress | |
wordpress: | |
entrypoint: apache2-foreground | |
depends_on: | |
- db | |
image: jankoch/wordpress:latest | |
ports: | |
# adjust port if necessary to avoid conflicts | |
- 80:80 | |
restart: on-failure | |
volumes: | |
# Always use absolute path to WP install | |
- .:/var/www/html | |
environment: | |
# Update login data + table prefix from wp-config.php | |
WORDPRESS_DB_HOST: db:3306 | |
WORDPRESS_DB_PASSWORD: wordpress | |
WORDPRESS_TABLE_PREFIX: 'wp_' | |
#PhpMyAdmin will run under localhost:8889 | |
phpmyadmin: | |
image: phpmyadmin/phpmyadmin | |
depends_on: | |
- db | |
ports: | |
- 8889:80 | |
environment: | |
PMA_HOST: db | |
volumes: | |
db_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment