Skip to content

Instantly share code, notes, and snippets.

@AlaeddineMessadi
Last active September 30, 2020 11:44
Show Gist options
  • Save AlaeddineMessadi/7ba30ea2f97b9fa842aa860e48672f6a to your computer and use it in GitHub Desktop.
Save AlaeddineMessadi/7ba30ea2f97b9fa842aa860e48672f6a to your computer and use it in GitHub Desktop.
Quickstart: Compose and WordPress ( MySQL, WordPress) kickstarter docker-compose.yml
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: wp_example
MYSQL_USER: user_example
MYSQL_PASSWORD: pwd_example
wordpress:
depends_on:
- db
image: wordpress:latest
# Create ./wp-content under root diractory for plugin and theme mapping
volumes:
- ./wp-content:/var/www/html/wp-content
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: user_example
WORDPRESS_DB_PASSWORD: pwd_example
WORDPRESS_DB_NAME: wp_example
volumes:
db_data: {}
@AlaeddineMessadi
Copy link
Author

AlaeddineMessadi commented Sep 30, 2020

  1. Rename the file docker-compose-wordpress.yml to docker-compose.yml
  2. Create ./wp-content under root directory where the yml file is
  3. Update environment variables (WORDPRESS_DB_USER , WORDPRESS_DB_PASSWORD, WORDPRESS_DB_NAME )
  4. Run docker-compose up -d to pull the necessary images and starts the wordpress and database containers
  5. URL: http://localhost:8000 or http://localhost:8000/wp-admin
  6. Open your favorite IDE and start coding immediately

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