Docker Community Forums

Share and learn in the Docker community.

Data directory "/var/lib/postgresql/data" has invalid permissions

I am new to Docker and have learnt a couple of commands. I am trying to run a postgres database container via Docker and after pulling postgres with
docker pull postgres

I proceeded to running a container the container with the command:
docker run -d -p 3005:3005 --name postgres-wikijs-3005 --restart unless-stopped -e "DB_TYPE=postgres" -e "DB_HOST=postgres-wikijs-3005" -e "DB_PORT=5432" -e "DB_USER=wikijs" -e "DB_PASS=wikijs" -e "DB_NAME=postgres-wikijs-3005" requarks/wiki:2

But the container automatically stops running a few seconds after it starts with an error:

The files belonging to this database system will be owned by user “postgres”.
This user must also own the server process.

The database cluster will be initialized with locale “en_US.utf8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data … ok
creating subdirectories … ok
selecting dynamic shared memory implementation … posix
selecting default max_connections … 20
selecting default shared_buffers … 400kB
selecting default time zone … Etc/UTC
creating configuration files … ok
2021-01-15 17:11:36.428 UTC [83] FATAL: data directory “/var/lib/postgresql/data” has invalid permissions
2021-01-15 17:11:36.428 UTC [83] DETAIL: Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
child process exited with exit code 1
initdb: removing contents of data directory “/var/lib/postgresql/data”
running bootstrap script …

How can i access the “/var/lib/postgresql/data” to modify the permissions via command line? I can’t seem to find that path in my local drive.


Resolved the issue by accessing bash terminal and enabling permissions with ‘chmod’ commands