mkdir: cannot create directory ‘/backups/daily/ even running mkdir and chown #95
-
Hi, I followed the readme and tried to run commands to create the directory to store the backups with this:
When I run the commands I neet to do it with sudo to make it work, because if don't it throws this error: chown: changing ownership of '/var/opt/pgbackups': Operation not permitted and mkdir: cannot create directory ‘/var/opt/pgbackups’: Permission denied I don't have postgresql on host, only on container but even running those commands it keeps saying : 2021/07/22 03:39:23 443 cmd: /backup.sh I'm using a VPS with ubuntu 20.04, Docker version 20.10.7 build f0df350, docker-compose version 1.25.0 I also ran docker-compose exec db /bin/bash and inside it I got uid 70 and gid 70 for postgres user/group but even assignin those uid and gid keeps throwing permission denied. I'm missing a step? Running ls on /var/opt/pgbackups:
Running id postgres on docker-compose -f docker-compose.prod.yml exec db /bin/bash:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hello @quevon24, it looks like a configuration error. The path For what you are exposing, looks like you did not configure the volumes:
- /var/opt/pgbackups:/backups Also as stated in the README, running as postgresql user is optional, so you can disable it for your setup. Please close the issue if manged to fix your deployment. |
Beta Was this translation helpful? Give feedback.
-
I don't know why this happens, but I stopped all containers, removed them and then create and start them from scratch and the problem vanished, thanks for answering so fast and great job! |
Beta Was this translation helpful? Give feedback.
-
I used the example docker compose and am getting the same issues.
which makes no sense to me, as the
Any help? |
Beta Was this translation helpful? Give feedback.
Hello @quevon24, it looks like a configuration error.
The path
/var/opt/pgbackups
is an example path (it is the one specified in thedocker-compose.yml
example), you will need to specify the local path of the/backups
volume you configured. Also those commands are meant to be run outside the docker itself and with the correct user as you did (so sudo might be required if you are using a rooted docker daemon configuration).For what you are exposing, looks like you did not configure the
volumes
correctly, if you want to use the local folder/var/opt/pgbackups
for backups as you are configuring. Then ensure this lines are set up in youpostgres-backup-local
container (look at the example in…