Docker dpage/pgAdmin - permission denied /var/lib/pgadmin/storage

Viewed 404

i have a dpage/pgadmin:latest Docker container running on an Ubuntu 20.04.

Client: Docker Engine - Community
 Version:           20.10.8

Server: Docker Engine - Community
 Engine:
  Version:          20.10.8

docker-compose version 1.25.4, build 8d51620a

Now i want to manually save my backups from my database created with pgadmin to another location. The backups created with pgadmin are stored in /var/lib/pgadmin/storage. So i add this path to my docker volumes in my docker-compose.yml.

    volumes:
      - pgadmin_dat:/var/lib/pgadmin
      - /etc/localtime:/etc/localtime:ro
      - pgadmin_share:/var/lib/pgadmin/storage

When i now start the container i get this error:

werkzeug.exceptions.InternalServerError: 500 Internal Server Error: The user does not have permission to read and write to the specified storage directory.

This error occurs because the directory in my volume got root:root as owner and not 5050:5050 like mentioned here: pgAdmin Container Deployment

When i change the permissions on my volume with sudo chown -R 5050:5050 <pgadmin_share> and sudo chmod -R u+rwx the error disappears and pgAdmin is available.

When i create a backup i have to set the permissions again on the automatically created subdiretory (username of the pgadmin user).

Is there a problem with the nested volume, because i mounted already pgadmin_dat:/var/lib/pgadmin ?

I'm curious about how i can solve this better.

I would be happy about any suggestion.

0 Answers
Related