Skip to content

Instantly share code, notes, and snippets.

@theonlydaleking
Last active July 6, 2018 07:58
Show Gist options
  • Save theonlydaleking/03e1f637e4d65561261f22f6f96ea7fb to your computer and use it in GitHub Desktop.
Save theonlydaleking/03e1f637e4d65561261f22f6f96ea7fb to your computer and use it in GitHub Desktop.
docker setup for wordpress, mariadb and phpmyadmin
version: '2'
services:
db:
container_name: database
image: mariadb # Pull mysql image from Docker Hub
ports: # Set up ports exposed for other containers to connect to
- "3306:3306"
volumes:
- ./dep/mysql:/docker-entrypoint-initdb.d
environment: # Set up mysql database name and password
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
WORDPRESS_TABLE_PREFIX: sM2_
wordpress:
image: wordpress
container_name: wordpress
depends_on:
- db
ports:
- "9001:80"
volumes: # Mount relative path source folder on host to absolute path destination folder on docker container
- ./theme:/var/www/html/wp-content/themes/theme_name
- ./dep/plugins:/var/www/html/wp-content/plugins
- ./dep/uploads:/var/www/html/wp-content/uploads
links:
- db
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
depends_on:
- db
restart: always
ports:
- "9002:81"
environment:
- PMA_ARBITRARY=1
@theonlydaleking
Copy link
Author

theonlydaleking commented Jul 6, 2018

wordpress should be on localhost:9001
phpmyadmin will be on localhost:9002

docker exec -t -i wordpress /bin/bash if you need to modify files

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