What is the best way to run a command in the offen/docker-volume-backup
container before creating a backup?
#504
Unanswered
ottobolyos
asked this question in
Q&A
Replies: 1 comment 14 replies
-
Is there anything that keeps you from updating the Image version? Newer versions support running as non-root https://offen.github.io/docker-volume-backup/how-tos/use-as-non-root.html |
Beta Was this translation helpful? Give feedback.
14 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using using
timescale/timescaledb-ha
which runs PostgreSQL and all related commands aspostgres
user which has UID/GID set to1000
(it is a non-root, non-system user). This causes an issue, asdocker-volume-backup
runs all commands areroot
, therefore everytime it creates a backup, the files are root-owned andpg_dumpall
cannot access/overwrite the files in a subsequent backup.Now, this can be easily worked around by running
chown -R 1000:1000 /backup
in thedocker-volume-backup
container before actually creating the backup. However, what is the best way to accomplish this?Note that ATM I am using
offen/docker-volume-backup:v2.25.1
(set up by a former colleague) and I use the backup label on the database container to defined the backup command:"docker-volume-backup.exec-pre=/bin/sh -c 'pg_dumpall -U $PGUSER --clean --file /home/postgres/pgdata/backup/dumpall.sql'"
As that
docker-volume-backup
version still uses externalcron
, I could bind-mount/var/spool/cron/crontabs/root
and change the ownership of/backup
before runningbackup
(i.e.0 1 * * * chown -R 1000:1000 /backup && backup 2>&1
), I’d like to have a kind of confirmation if this will work and is the best solution from your PoV.Thank you in advance! 🙏
Beta Was this translation helpful? Give feedback.
All reactions