Docker Community Forums

Share and learn in the Docker community.

Automatic backup of docker ERPNext volumes

KDE Neon
Docker is locally hosted on my PC

I installed ERPNext via docker compose and everything works great except I can’t figure out how to make backups work. I have found multiple articles on how to backup the docker volumes, but I don’t really know what to do.

I am currently using Vorta to backup my personal files to an external HDD. Would be nice if I can keep the process that simple.

I want to backup the ERPNext data to a HDD.

Can someone help me to make automatic backups so that ERPNext’s setttings along with the Mariadb database is backed up while the containers are running?

Just some ideas:

#1 if ERPNext does it’s own daylie backup achives:
I would expect ERPNext to create daylie backups itself. If this is the case, you just need to make sure that they are written into a bind-mount. This would allow to add the host path of the bind-mount to your backup programm and be good. Since this should already be a consitent backup,

#2 if ERPNext doesn’t create backup achives itself:
It depends whether you use named volumes or bind-mounts (=path on host). In both cases I would suggest to stop the application in order to have consistent backups.

With bind-mounts you would simply backup the path on the host and restart the container again then.

With named volumes the cleanest approach would be to create a temporary “backup container” (=any base os image will do) using the same volumes + a bind-mount to be able to store data outside the container, having a “command” that creates a tar archive of the volume and writes it into the bind-mount. Once the container did the backup you can restart it again and use your backup tool to backup the created archive.

If your backup tool allows pre-exec and post-exec scripts, you will want to put the container stop command + if named values are used the “backup container” command into the pre-exec and the container restart in the post-exec.

#3 look for a backup tool that actualy supports docker?
Since Docker is arround 8 years now, I would expect that at least a couple of backup products should have direct support for it - is anyone using such a product and can recommend it?

Yes I do believe that ERPNext creates its own backups. Though I would need to get them backed up to a bind-mount then adjust the backup frequency. Restoring I don’t even have any idea how to do. This seems like the best solution since I can then just backup files like I normally would.

I have read that Bacula supports Docker, but the process is still tedious, because the containers have to be stopped.

Link to my post on ERPNext forums.