【发布时间】:2023-02-26 04:12:37
【问题描述】:
我在 postgresql 图像的文件权限方面遇到问题。 (如果有人知道如何在那里提供帮助,则与 redis 有类似的问题) 我的文件在 synology nas 上,卷是用 nfs 挂载的。我有一个需要数据库的服务用户和一个只在这里进行备份的用户,因此需要对文件的读取权限。但是,postgres 正在更改文件权限,我无法弄清楚如何允许备份用户读取文件。我希望 postgres 使用给定的用户。
这是我的撰写文件的汇编:
services:
postgresql:
image: docker.io/library/postgres:12-alpine
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
start_period: 20s
interval: 30s
retries: 5
timeout: 5s
user: "1050:100"
volumes:
- persist_postgresql:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=xxx
- POSTGRES_USER=xxx
- POSTGRES_DB=xxx
networks:
- default
backup:
image: restic/restic
entrypoint: sh -c
command: >
"([ -f /srv/restic-repo/config ] || (restic init --repo /srv/restic-repo; mkdir /srv/restic-repo/tmp)) &&
restic backup --host myHost --exclude=\"sends\" --no-scan /source &&
restic forget --keep-hourly 168 --keep-daily 30 --keep-weekly 52 --keep-monthly 60"
volumes:
- persist_postgresql:/source
- target:/srv/restic-repo
environment:
- RESTIC_REPOSITORY=/srv/restic-repo
- RESTIC_PASSWORD=xxx
- TMPDIR=/srv/restic-repo/tmp
- RESTIC_CACHE_DIR=/srv/restic-repo/cache
- RESTIC_COMPRESSION=max
user: "1051:100"
deploy:
labels:
- "swarm.cronjob.enable=true"
- "swarm.cronjob.schedule=0 0 * * * *"
- "swarm.cronjob.skip-running=true"
restart_policy:
condition: none
volumes:
persist_postgresql:
driver_opts:
type: "nfs"
o: "addr=192.168.xxx,nolock,soft,rw"
device: ":xxx/postgresql"
【问题讨论】:
标签: docker