Docker restore backup

I have installed local docker and everything is working fine. Using the official guide on github.
I have my database downloaded, how do i use the backup to restore the site ?

You’ve to get the files available in container with erpnext-worker image.

  1. use docker cp command to copy files from host machine to running container
  2. use docker run command to start a new container. Mount volume backup files, sites-vol (for configuration and sites) and run the backup / restore / new-site command
1 Like

There are two approaches here: you can do backup/restore at the container level with docker’s mechanisms, or you can do it at the site level using frappe’s mechanisms. If you’ve got a database backup made using frappe’s bench backup command, the easiest way to restore is to use bench restore:

https://frappeframework.com/docs/v13/user/en/bench/reference/restore

1 Like

tnx for taking your time and answering my novice questions all the time
sry but I have no idea what that means

1 Like

tried restore in frappe container, no success.
I think I don’t know which container i must run it in.

1 Like

Hi,

I think you are on the right container, but you used the order resotre instead of restore

Hope this helps, regards

Alb

1 Like

lols yeah, sry my bad. here is the actual image:

Hi,

I think you would need to locate the backups inside the volume that contains the actual site.

That from memory it should be located (at least it is in there on my Ubuntu installation) in /var/lib/docker/volumes/“the name of your site volume”

Yes, on my case it is in: /var/lib/docker/volumes/your-project-name_sites-vol/_data

And for the restore I generally locate the files on backup folder just under _data that I delete later and do:

bench --site erp.yourdomain.com restore ./backup/database.sql.gz --with-public-files ./backup/files.tar --with-private-files ./backup/private-files.tar

3 Likes

Well that did the trick and i was able to restore…
the bad news is the site is down with internal server error

check log for erpnext-python container

If it was permission error before, then make sure contents under sites-vol are owned by uid:gid 1000:1000

execute:

cd _data
chown -R 1000:1000 .
1 Like

Well I did nothing extra and gave up, after a restart i saw that some containers stopped, so i started them and everything is fine.

Hi,

I also want to restore the files backup from eprnext version 13.0 to version 13.20 installed on another machine. My 1st question is can I do so? And my 2nd question is I have the docker version of erpnext and will the bench command still work? When I tried to run the restore command it presented an error:
var/lib/docker/volumes/frappe_docker_sites-vol/_data#
bench --site erp.domainname.com restore ./erpx_file_backup/database.sql.gz --with-public-files ./erpx_file_backup/files.tar --with-private-files ./erpx_file_backup/private-files.tar

Command ‘bench’ not found, did you mean:

command ‘tbench’ from deb dbench (4.0-2build1)
command ‘dbench’ from deb dbench (4.0-2build1)

Try: apt install

Do I have to install bench?

just changing working directory to the location of volume on the host machine won’t make it execute commands from the container.

use docker exec to run commands from container.

OK. Thanks!

Thank you!

I get following message after running

~/frappe-bench/sites$ bench --site erp.insertyoursitehere.com restore ./backup/database.sql.gz --with-public-files ./backup/files.tar --with-private-files ./backup/private-files.tar

inside the container:

/bin/sh: 1: cannot create /home/frappe/frappe-bench/sites/backup/database.sql: Permission denied

Could you assist with this?