Docker container to backup mariadb instance using mariabackup.
Largery based on https://github.com/khoanguyen96/dockerfiles/tree/master/percona-xtrabackup
To backup:
#!/bin/bash
docker run --rm \
-e HOST="nextcloud_db" \
--net webgateway \
-v /srv/nextcloud/mariadb:/var/lib/mysql \
-v /srv/mysqlbackup/backup.cnf:/etc/mysql/backup.cnf \
-v /srv/mysqlbackup/encryption_key:/backups/mysql/encryption_key \
-v /srv/mysqlbackup/backup:/backups/mysql \
cardonaje/perconaxtrabackup:latest \
backup-mysql.sh
To extract backup:
#!/bin/bash
docker run --rm \
-e DAY="Mon" \
--net webgateway \
-v /srv/nextcloud/mariadb:/var/lib/mysql \
-v /srv/mysqlbackup/backup.cnf:/etc/mysql/backup.cnf \
-v /srv/mysqlbackup/encryption_key:/backups/mysql/encryption_key \
-v /srv/mysqlbackup/backup:/backups/mysql \
cardonaje/perconaxtrabackup:latest \
extract-mysql.sh full-12-17-2018_14-29-22.xbstream
To prepare backup:
#!/bin/bash
docker run --rm \
-e DAY="Mon" \
--net webgateway \
-v /srv/nextcloud/mariadb:/var/lib/mysql \
-v /srv/mysqlbackup/backup.cnf:/etc/mysql/backup.cnf \
-v /srv/mysqlbackup/encryption_key:/backups/mysql/encryption_key \
-v /srv/mysqlbackup/backup:/backups/mysql \
cardonaje/perconaxtrabackup:latest \
prepare-mysql.sh