Postgres Docker container persists data on a fileserver (nfs/webdav)- solving security issue

For specific tests I want to run a Postgres Docker container. I want the data persisted in this specific situation on a folder on a filestore (nfs).

Try1: Via a regular/standard volume I make a ‘mount’ on the webdav. The folder exists.

The Postgres (initdb) process complaints that it cannot ‘chown’ the mounted folder.

Try2: OK, the I added the “PGDATA” parameter in the docker-compose.yaml to a subfolder of the mounted folder.

The Postgres (initdb) process complaints that it cannot ‘chown’ the mounted folder and the subfolder.

Try3: Then I added to the ‘addr=’ a username and password of the WebDav. Nothing changes.

How to solve this issue? It should be a fairly common (test) config.

Using a volume on a host server works fine, but not in this specific case.

Please read the Postgres docs. You can not use a remote file system that does not support file locking. At least not if you care about consistent data, and want to avoid inconsistencies or corrupt database files on the long run.

2 Likes