Skip to content

Instantly share code, notes, and snippets.

@standinga
Created June 17, 2019 23:59
Show Gist options
  • Save standinga/58df085dc5b5c2f447c7122859fe2975 to your computer and use it in GitHub Desktop.
Save standinga/58df085dc5b5c2f447c7122859fe2975 to your computer and use it in GitHub Desktop.
docker-compose for medium post about moving existing wordpress into docker containers
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- ./wordpress.sql:/docker-entrypoint-initdb.d/init.sql # prepopulate database
- db_data:/var/lib/mysql # persist database data inside docker storage
restart: always
env_file:
- .env
environment:
DOCKER_COMPOSE_YML_LOCATION: ${PWD}
container_name: wp_db
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
ports:
- "8080:80"
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
DOCKER_COMPOSE_YML_LOCATION: ${PWD}
container_name: wp_phpmyadmin
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: ${MYSQL_USER}
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
DOCKER_COMPOSE_YML_LOCATION: ${PWD}
volumes:
- ./wp-content:/var/www/html/wp-content
container_name: wp_wordpress
volumes:
db_data: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment