Skip to content

Instantly share code, notes, and snippets.

@isalgueiro
Created July 18, 2017 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isalgueiro/ee2df82168f4f065d9f7077852e89292 to your computer and use it in GitHub Desktop.
Save isalgueiro/ee2df82168f4f065d9f7077852e89292 to your computer and use it in GitHub Desktop.
Docker compose for wordpress
version: '3.1'
services:
mywebdb:
image: mysql:5.7
volumes:
- mywebdb_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: supersecretpassword
myweb:
depends_on:
- mywebdb
image: wordpress:4.8.0-php7.0-apache
volumes:
- myweb_data:/var/www/html
ports:
- 80:80
environment:
WORDPRESS_DB_PASSWORD: supersecretpassword
WORDPRESS_DB_HOST: mywebdb
volumes:
myweb_data:
mywebdb_data:
@isalgueiro
Copy link
Author

To backup mysql database

docker exec ${mywebdb container} mysqldump -uroot -psupersecretpassword wordpress > backup.sql

To execute queries in MySQL

docker exec -it ${mywebdb container}  mysql -uroot -psupersecretpassword

To backup wordpress web files

docker cp ${myweb container}:/var/www/html .

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