Docker Community Forums

Share and learn in the Docker community.

What is the proper way to backup volumes without downtime?

Hi,

I have multiple docker containers with named and bind volumes.

For some critical applications, I use external software like mongodump/pgdump/mysqldump for databases and works well.

For others applications which are essentially text files, I use :
docker run --rm -v volumetobackup:/tmp/volumetobackup -v /host/backupfolder:/backup ubuntu tar -C "/tmp/" -P -czf "/backup/volumetobackup/tar.gz" "volumetobackup" or I directly copy from mount-point

These files are not changing a lot, except during upgrade. For example, on a website changes are essentially cache/sessions/user upload.

I notice on a lot of tutorials, they recommend to stop the container before backup.
However, I would like to avoid downtime.

Why it is recommended to stop container, it is only to avoid files consistency issue (files which are opened/written during backup) ?