MariaDB Docker Container - Setup Daily Backup with Crontab
Every day at 7:00 PM I make a dump of every MariaDB database. This can be done by calling
mysqldump from the MariaDB container. I’m using the
crontab to schedule this.
It is important for me to also include the database
routines in the backup because I use them with some databases.
I have the dump placed in a folder that I backup daily. In this case it is a backup folder within the folder of the MariaDB Docker container.
As an example I’m using the Home Assistant database
I added the following to the
0 19 * * * /snap/bin/docker exec mariadb mysqldump --routines --user=USER --password=PASSWORD homeassistant > /home/LINUX-USER/docker/mariadb/backup/homeassistant.sql
Replace the following:
Replace with your own database password
Replace with your own database user
Replace with your own linux user
/snap/bin/docker is the full path of the Docker executable when running Docker with Snap. When not using Snap you can try
Read other notes
No comments found for this note.
Join the discussion for this note on this ticket. Comments appear on this page instantly.
Notes mentioning this note
- Docker - MariaDB Container Setup
Here I describe my setup of the Docker MariaDB container.