-
-
Notifications
You must be signed in to change notification settings - Fork 360
Closed
Description
Description
docker compose up fails when trying to start PostgreSQL. The container exits with an error about data directory format incompatibility.
Steps to Reproduce
- Run
docker compose build - Run
docker compose up - Watch postgres-db container fail
Error Message
Root Cause
The docker-compose.yml specifies image: postgres with no version tag. Docker pulls the latest PostgreSQL (currently 18). PostgreSQL 18 changed the expected data directory path from /var/lib/postgresql/data to /var/lib/postgresql, causing a mismatch.
Solution
Either:
- Pin PostgreSQL to 16:
image: postgres:16 - Update the volume mount path to match PostgreSQL 18 expectations:
/var/lib/postgresql
I can submit a PR with the fix if you decide which approach is preferred.
Environment
- Docker version: 28.3.3
- Docker Compose: v2
References
- https://hub.docker.com/_/postgres (PostgreSQL 18 release notes)
- Change
PGDATAin 18+ to/var/lib/postgresql/MAJOR/dockerdocker-library/postgres#1259
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done