Skip to content

Conversation

@mattgallagher92
Copy link
Contributor

This is to resolve errors like the following, now that postgres:latest resolves to the v18 image by default.

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.

This is to resolve errors like the following, now that postgres:latest
resolves to the v18 image by default.

```quote
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 docker-library/postgres#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 docker-library/postgres#37 for a (long)
discussion around this process, and suggestions for how to do so.
```
@mattgallagher92
Copy link
Contributor Author

Note: I'm not a Postgres expert, so this configuration may be undesirable for reasons that I haven't considered. Of course, feel free to edit/reject this PR if that's the case.

@mattgallagher92 mattgallagher92 marked this pull request as ready for review November 24, 2025 16:56
Copy link
Collaborator

@stevensJourney stevensJourney 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 this! For our simple demo use-case, this looks good to me. I'll make a minor followup PR to add a changelog entry for this. I'll also explicitly set the Postgres Docker image version there.

@stevensJourney stevensJourney merged commit 797d67f into powersync-ja:main Nov 25, 2025
@mattgallagher92 mattgallagher92 deleted the change-postgres-volume-mount-points branch November 25, 2025 10:12
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