Repository navigation
Fix Postgres 18 data volume mount in production Compose file - #84
Merged
Merged
Conversation
Postgres 18 images keep their data in a versioned subdirectory of /var/lib/postgresql and refuse to start when a volume is mounted at the old /var/lib/postgresql/data path, even an empty one. The dev Compose file and the wiki example were updated with the Postgres 18 upgrade, but docker-compose.prod.yml wasn't. Also fix the wiki's Postgres upgrade steps: the container has to be removed before its volume can be deleted, and recreated (not just started) afterwards.
Earthmark
approved these changes
Nov 1, 2026
Earthmark
left a comment
Collaborator
There was a problem hiding this comment.
Makes sense and I ran into the same issue in another repo. As long as the migration has allready happened this seems fine (and the version is already 18 in the compose file, looks like it has).
Seems the migration procedure was already listed, I'm worried about data loss because it says delete the volume, but it's true and correct.
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 upgrade (140132d) updated the dev Compose file and the wiki example to mount the data volume at
/var/lib/postgresql, butdocker-compose.prod.ymlstill mounted it at/var/lib/postgresql/data. Postgres 18 images keep their data in a versioned subdirectory (/var/lib/postgresql/18/docker) and exit at startup when anything is mounted at the old path, even an empty volume:So the production stack can't start Postgres at all on
mainright now.Changes
docker-compose.prod.yml: mount thepostgresvolume at/var/lib/postgresql.wiki/Setup-(Docker).md, Postgres upgrades section:docker compose rm --stop --force postgresinstead of just stopping it. Docker won't delete a volume that a stopped container still references.docker compose up -d postgresinstead ofdocker compose start postgres.startwould restart the old container, whose volume was deleted.Upgrade notes
Testing
postgres:18container with a volume at/var/lib/postgresql/data: it exits with the error above, even with an empty volume./var/lib/postgresql: it initializes and starts normally, with PGDATA at/var/lib/postgresql/18/docker.