fix(compose): mount postgres 18 volumes at /var/lib/postgresql - #412
Merged
Conversation
The postgres:18 images moved PGDATA to a major-versioned subdir (/var/lib/postgresql/18/docker) and refuse to start when anything is mounted at the pre-18 /var/lib/postgresql/data path — bind mount, named volume, or tmpfs, even when empty (docker-library/postgres#1259). Since the 18-alpine bump (#347): - compose.dev.yml crash-looped against the PG17-initialized dev volume, and would keep failing even on a fresh volume because of the mount path. Dev volumes initialized under an older major need a dump/restore; the recipe is in the comment. - compose.prod.yml would fail any fresh deployment the same way. Existing deployments upgrading from a pre-18 volume get the entrypoint's explicit old-cluster error and must dump/restore or pg_upgrade. - compose.test.yml's tmpfs made 'just docker-test' fail on postgres startup (not caught by CI — the smoke compose is local-only; CI just builds the images). All three now mount the parent /var/lib/postgresql as the 18+ images expect. Verified locally: dev stack healthy on a restored PG17 dump (all 73 table counts identical), and postgres:18-alpine boots clean with tmpfs at the parent path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The postgres:18 images moved PGDATA to a major-versioned subdirectory (
/var/lib/postgresql/18/docker) and refuse to start when anything is mounted at the pre-18/var/lib/postgresql/datapath — bind mount, named volume, or tmpfs, even when empty (docker-library/postgres#1259; the entrypoint flags the mountpoint as an "unused mount/volume" old cluster). Since the 18-alpine bump in #347, all three compose files were affected:pg_upgrade— probably worth a release-note when this ships.just docker-testat postgres startup. CI never caught it because the smoke compose is local-only (CI only builds the images).All three now mount the parent
/var/lib/postgresql, the layout the 18+ images require (and which keeps futurepg_upgrade --linkruns inside one mount).Verification
postgres:18-alpine: empty bind mount, fresh named volume, and tmpfs at/var/lib/postgresql/dataall refuse to start; tmpfs and bind mounts at/var/lib/postgresqlinit cleanly into18/docker/.pg_dumpallunder a temporary PG17 container → fresh PG18 cluster on the new mount → restore. All 73 table row counts identical pre/post; dev stack healthy; app verified end-to-end against the restored data.