Include command/script to backup main DB to a configured location
To prevent the need for every compose project to implement their own backup logic in detail (see the VCR's backup.sh), such a script could be included in the image, so that one would only have to run, e.g.
docker exec my_mariadb_container backup [-t /my-custom-location]
and only take care of the post-processing (putting the file in the desired location) if necessary.
Perhaps a default target location inside the container can be made configurable with an environment variable (e.g. BACKUP_TARGET_DIRECTORY
). In compose projects this would then be matched with a host mount so that backups can easily be picked up at the host level.
Edited by Twan Goosen