Skip to content

Docs: Fix PostgreSQL volume mapping to prevent data loss#5417

Open
fankes wants to merge 1 commit intoNginxProxyManager:developfrom
fankes:develop
Open

Docs: Fix PostgreSQL volume mapping to prevent data loss#5417
fankes wants to merge 1 commit intoNginxProxyManager:developfrom
fankes:develop

Conversation

@fankes
Copy link

@fankes fankes commented Mar 19, 2026

After testing, I found a critical error in the configuration documentation regarding the PostgreSQL database volume mapping. The current configuration prevents data from persisting correctly during container restarts or migrations, leading to data loss. Below are the details of the fix.

The Issue

The current docker-compose.yml example for PostgreSQL uses ./postgresql:/var/lib/postgresql as a volume mapping.

According to the official PostgreSQL Docker image documentation, the data directory is located at /var/lib/postgresql/data. Mapping the parent directory instead of the specific data subdirectory is a "hidden trap" that leads to:

  1. Data Persistence Failures: The database may fail to re-attach to existing data after a container recreation.
  2. Permission Conflicts: Mapping the parent directory often causes permission issues on the host side, leading to initialization loops (as I experienced multiple times).

The Fix

Updated the documentation example to explicitly point to the /data subdirectory:
./postgres_data:/var/lib/postgresql/data.

This ensures that the internal database files are correctly persisted for users following this guide.

@nginxproxymanagerci
Copy link

Docker Image for build 1 is available on DockerHub:

nginxproxymanager/nginx-proxy-manager-dev:pr-5417

Note

Ensure you backup your NPM instance before testing this image! Especially if there are database changes.
This is a different docker image namespace than the official image.

Warning

Changes and additions to DNS Providers require verification by at least 2 members of the community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant