Dostic lets you backup all named Docker volumes into a restic repository and helps you to restore from it. It detects MariaDB and MongoDB volumes automatically and performs hot online backups using Mariabackup and mongodump.
-
Put password for restic repository in a file called
restic_password
. -
Copy
dostic.conf.example
todostic.conf
and adjust settings. -
If you want to use Rclone backend in restic, you should start the configuration wizard:
./dostic.sh configure
-
Initialize restic repository and test connection:
./dostic.sh init
- Run:
./dostic.sh backup
-
List all restic snapshots:
./dostic.sh list
-
Restore regular data volume:
./dostic.sh restore_volume <snapshot> <restic-directory> <volume-or-directory>
-
Restore MariaDB volume:
./dostic.sh restore_mariadb <snapshot> <restic-xbstream> <mariadb-image> <volume-or-directory>
-
Restore MongoDB volume:
./dostic.sh restore_mongodb <snapshot> <restic-mdb> <mongo-image> <volume-or-directory>
-
Backup all named Docker volumes (and host directories specified in
BACKUP_DIRS
):-
Just execute:
./dostic.sh backup
-
-
Restore regular volume named
my_data
:-
Create a new volume:
docker create volume restored_data
-
Restore data from latest snapshot:
./dostic.sh restore_volume latest my_data restored_data
-
-
Restore MariaDB data volume named
my_database
:-
Create a new volume:
docker create volume restored_database
-
Restore data from latest snapshot using MariaDB 10.3 Docker image:
./dostic.sh restore_mariadb latest my_database mariadb:10.3 restored_database
-
- The content of container labels
dostic.precmd
anddostic.postcmd
is executed usingdocker exec
before and after backup of associated volumes. E.g. adddostic.precmd=redis-cli save
to a redis container to ensure all data is written to disk before starting the backup. restic forget
is executed on sundays automatically using parameters provided inRESTIC_FORGET_ARGS
.- Directories containing a file
.nobackup
are ignored.