What is the best way to run a command in the offen/docker-volume-backup container before creating a backup?
#504
Replies: 1 comment 21 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.
21 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using using
timescale/timescaledb-hawhich runs PostgreSQL and all related commands aspostgresuser which has UID/GID set to1000(it is a non-root, non-system user). This causes an issue, asdocker-volume-backupruns all commands areroot, therefore everytime it creates a backup, the files are root-owned andpg_dumpallcannot access/overwrite the files in a subsequent backup.Now, this can be easily worked around by running
chown -R 1000:1000 /backupin thedocker-volume-backupcontainer 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-backupversion still uses externalcron, I could bind-mount/var/spool/cron/crontabs/rootand change the ownership of/backupbefore 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