Skip to content

Instantly share code, notes, and snippets.

@iansinnott
Last active December 8, 2017 21:52
Show Gist options
  • Save iansinnott/241e4d23904ed1fd175c8ceb963b32f1 to your computer and use it in GitHub Desktop.
Save iansinnott/241e4d23904ed1fd175c8ceb963b32f1 to your computer and use it in GitHub Desktop.
quick-wordpress-docker-compose
version: '3'
services:
wordpress:
image: wordpress:4.9
ports:
- "127.0.0.1:8080:80"
volumes:
- ./wp-content/themes:/var/www/html/wp-content/themes
- ./wp-content/plugins:/var/www/html/wp-content/plugins
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_PASSWORD: wordpress
db:
image: mysql:5.7
ports:
- "127.0.0.1:3306:3306" # Expose so we can connect locally
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
volumes:
db_data:
@iansinnott
Copy link
Author

iansinnott commented Dec 8, 2017

Updated for docker-compose yaml v3.

wp-content is volumed in for local development of themes / plugins.

MySQL is also exposed locally since you probably want to be able to access it in dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment