Local backup not saving file
jimmyd-be opened this issue · comments
Describe the bug
I try to backup my postgres docker data to my NAS using the local archive functionality
To Reproduce
Steps to reproduce the behavior:
docker run --rm
-e BACKUP_FILENAME=postgres-%Y-%m-%dT%H-%M-%S.tar.gz
-e BACKUP_RETENTION_DAYS="7"
-e BACKUP_ARCHIVE=archive-postgres
-v /home/ubuntu/config/postgres-data:/backup/data:ro
-v /mnt/nas/postgres:/archive-postgres
-v /var/run/docker.sock:/var/run/docker.sock:ro
--entrypoint backup
offen/docker-volume-backup:v2
Expected behavior
The backup file should be in /mnt/nas/postgres
Version (please complete the following information):
- Image Version: 2.33.2
- Docker Version: 24.0.7
- Docker Compose Version (if applicable):
Additional context
What's the log output when you run this command?
time=2023-12-03T10:57:23.989Z level=INFO msg="Stopping 1 container(s) labeled docker-volume-backup.stop-during-backup=true
out of 11 running container(s)."
time=2023-12-03T10:59:33.103Z level=INFO msg="Created backup of /backup
at /tmp/postgres-2023-12-03T10-57-23.tar.gz
."
time=2023-12-03T10:59:34.080Z level=INFO msg="Restarted 1 container(s) and the matching service(s)."
time=2023-12-03T10:59:34.392Z level=INFO msg="Removed tar file /tmp/postgres-2023-12-03T10-57-23.tar.gz
."
time=2023-12-03T10:59:34.392Z level=INFO msg="Finished running backup tasks."
From the log output it seems the command isn't even trying to copy the file anywhere as otherwise you'd see this log line:
This means the following check fails on your setup
docker-volume-backup/cmd/backup/script.go
Lines 214 to 221 in e5c3b47
and the command thinks the mounted path does not exist. Could it be that the container is not allowed to write to your NAS somehow?
Also, the value you pass to BACKUP_ARCHIVE
is missing a leading slash, and should probably be /archive-postgres
.
Adding the leasdin slash to the BACKUP_ARCHIVE it go Fatal error running backup: copyArchive: error copying archive: (*localStorage).Copy: Error copying file to archive: open /archive-postgres/postgres-2023-12-03T12-01-01.tar.gz: permission denied. Normally the user that is running the docker should have permissions to write to that directory. I will check further
i tried using a local directory and that worked.