Skip to content

Instantly share code, notes, and snippets.

@emyrold
Created December 29, 2018 12:30
Show Gist options
  • Save emyrold/68ccab7fe5b1e12ac166a9620017aa12 to your computer and use it in GitHub Desktop.
Save emyrold/68ccab7fe5b1e12ac166a9620017aa12 to your computer and use it in GitHub Desktop.
version: '3.2'
services:
db:
# Specify the version of DB you want to run
image: mysql:5.7
volumes:
# TODO: create a directory "db_data" in the root folder of your installation
- db_data:/var/lib/mysql
restart: always
environment:
# Grab this data from wp-config.php
# TODO: Update DB_HOST in wp-config.php to "db:port"
# TODO: Update the database login in wp-config.php to the values set below
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
entrypoint: apache2-foreground
depends_on:
# Tell the WordPress container to talk to the DB container
- db
image: jankoch/wordpress:1.0
ports:
# Adjust port if necessary to avoid conflicts
- 8080:80
restart: always
volumes:
# Map your current directory to /var/www/html inside the Docker container
- .:/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_'
# Optional: start up PhpMyAdmin with WordPress and the DB
phpmyadmin:
image: phpmyadmin/phpmyadmin
depends_on:
# Tell PhpMyAdmin which DB container to connect to
- 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