Helps backup and restore your WordPress blog - in manual and automatic mode also.
1.1K
The Wordpress Backup is a simple Docker container, that helps backup and restore your WordPress blog - in manual and automatic mode also.
Given you have a WordPress blog and the its MySQL database running in Docker containers. If not, then move your existing blog into a Docker container.
The Docker image is available on the public Docker hub under the name kovacsguido/wp-backup.
To run the backup container with the docker run command, linking your WordPress and MySQL containers:
docker run --name <backup-container-name> --volumes-from=<wordpress-container-name> --link=<mysql-container-name>:mysql -d kovacsguido/wp-backup
You have to replace the placeholders:
<backup-container-name>: The name of your backup container<wordpress-container-name>: The name of your Wordpress container<mysql-container-name>: The name of your MySQL containerYou may also specify a volume to be able to access the backup files on the Docker host:
docker run --name <backup-container-name> -v </host/path/to/backups>:/backups --volumes-from=<wordpress-container-name> --link=<mysql-container-name>:mysql -d kovacsguido/wp-backup
</host/path/to/backups>: an absolute path on the system hosting the containersAfter creating a backup you find the backup files on that path on your host system.
To manually create a backup of your Wordpress blog use docker exec to run the backup command:
docker exec <backup-container-name> backup
<backup-container-name>: The name of your backup container
This will create two archive files under /backups in the container. If you mapped a volume you may see those files in the according directory on your host now. They should be named something like backup_20141030.sql.bz2 and backup_20141030.tar.gz.
The number within the filenames is a date in the format yyyyMMdd (4 digit year, 2 digit month, 2 digit day). This means there can only be one backup per day. If you do multiple backups a day the files will be replaced by the latest backup.
To restore a backup of your Wordpress blog use docker exec to run the restore command:
docker exec <backup-container-name> restore <date>
<date>: The timestamp of the backup to restore, in the format yyyyMMdd.This will restore the database as well as the HTML content of your Wordpress installation.
Per default wordpress-backup will automatically create a backup at 03:00 am every day. You can adjust that time by setting a cron expression to the variable BACKUP_TIME when creating the container. E.g. the following statement will create a container that does a backup at 2:00 am every day:
docker run --name <backup-container-name> --volumes-from=<wordpress-container-name> --link=<mysql-container-name>:mysql -e "BACKUP_TIME=0 2 * * *" -d kovacsguido/wp-backup
Per default, wordpress-backup will never delete your backup files, so you can do it yourself, if and when you like.
If you want to delete old backups automatically, you can set the environment variable CLEANUP_OLDER_THAN to a number of days. In that case wordpress-backup will automatically delete backup older than that, before doing the next backup.
For example CLEANUP_OLDER_THAN=100 will delete any backups, that are older than 100 days, as soon as the next (manual or automatic) backup is done.
Be aware that the cleanup process does use the unix file last modified date as reference, and not the date in the file name. So a backup called backup_20110101.sql.bz2 that was last modified yesterday, will be only 1 day old!
Content type
Image
Digest
sha256:d8b57a4f1…
Size
46.2 MB
Last updated
over 2 years ago
docker pull kovacsguido/wp-backup