Skip to content

Remove /data from postgres volume path#369

Merged
AlvaroRausell merged 1 commit intodevcontainers:mainfrom
NaivE2k4:patch-1
Oct 28, 2025
Merged

Remove /data from postgres volume path#369
AlvaroRausell merged 1 commit intodevcontainers:mainfrom
NaivE2k4:patch-1

Conversation

@NaivE2k4
Copy link
Contributor

Currently PG container fails to start with a long message: "
in 18+, these Docker images are configured to store database data in a
format which is compatible with "pg_ctlcluster" (specifically, using
major-version-specific directory names). This better reflects how
PostgreSQL itself works, and how upgrades are to be performed.
See also https://github.com/docker-library/postgres/pull/1259⁠
Counter to that, there appears to be PostgreSQL data in:
/var/lib/postgresql/data (unused mount/volume)
This is usually the result of upgrading the Docker image without
upgrading the underlying database using "pg_upgrade" (which requires both
versions).
The suggested container configuration for 18+ is to place a single mount
at /var/lib/postgresql which will then place PostgreSQL data in a
subdirectory, allowing usage of "pg_upgrade --link" without mount point
boundary issues.
See https://github.com/docker-library/postgres/issues/37⁠ for a (long)
discussion around this process, and suggestions for how to do so.
"
According to that, you should have "a single mount at /var/lib/postgresql", so this is that change Tested on a local single container of postgres:latest, works

Currently PG container fails to start with a long message:
"
in 18+, these Docker images are configured to store database data in a
       format which is compatible with "pg_ctlcluster" (specifically, using
       major-version-specific directory names).  This better reflects how
       PostgreSQL itself works, and how upgrades are to be performed.
       See also https://github.com/docker-library/postgres/pull/1259⁠
       Counter to that, there appears to be PostgreSQL data in:
         /var/lib/postgresql/data (unused mount/volume)
       This is usually the result of upgrading the Docker image without
       upgrading the underlying database using "pg_upgrade" (which requires both
       versions).
       The suggested container configuration for 18+ is to place a single mount
       at /var/lib/postgresql which will then place PostgreSQL data in a
       subdirectory, allowing usage of "pg_upgrade --link" without mount point
       boundary issues.
       See https://github.com/docker-library/postgres/issues/37⁠ for a (long)
       discussion around this process, and suggestions for how to do so.
"
According to that, you should have "a single mount at /var/lib/postgresql", so this is that change
Tested on a local single container of postgres:latest, works
@NaivE2k4 NaivE2k4 requested a review from a team as a code owner October 26, 2025 19:56
Copy link
Contributor

@AlvaroRausell AlvaroRausell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@AlvaroRausell AlvaroRausell merged commit 1feec50 into devcontainers:main Oct 28, 2025
3 checks passed
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.

2 participants