https://github.com/tractr/docker-images/tree/main/backups/mysql
482
Volumerize can execute scripts before and after the backup process.
With this prepost strategy you can create a .sql backup of your MySQL containers and save it with Volumerize.
Aside of the required environment variables by Volumerize, this prepost strategy will require a couple of extra variables.
| Name | Description |
|---|---|
| MYSQL_USERNAME | Username of the user who will perform the restore or dump. |
| MYSQL_PASSWORD | Password of the user who will perform the restore or dump. |
| MYSQL_HOST | IP or domain of the host machine. |
| MYSQL_DATABASE | Database to backup / restore. |
version: "2"
services:
mariadb:
image: mariadb
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=1234
- MYSQL_DATABASE=somedatabase
volumes:
- mariadb:/var/lib/mysql
volumerize:
image: tractr/mysql-backup
environment:
- VOLUMERIZE_SOURCE=/source
- VOLUMERIZE_TARGET=file:///backup
- MYSQL_USERNAME=root
- MYSQL_PASSWORD=1234
- MYSQL_HOST=mariadb
- MYSQL_DATABASE=somedatabase
volumes:
- volumerize-cache:/volumerize-cache
- backup:/backup
depends_on:
- mariadb
volumes:
volumerize-cache:
mariadb:
backup:
Then execute docker-compose exec volumerize backup to create a backup of your database and docker-compose exec volumerize restore to restore it from your backup.
Content type
Image
Digest
Size
196.3 MB
Last updated
about 5 years ago
docker pull tractr/mysql-backup