🐛 PostgreSQL container fails to start due to incompatible existing data directory
📄 Description
When starting the project locally, the PostgreSQL container fails to initialize due to an incompatible existing data directory.
This happens even without any explicit database version upgrade performed by the user.
⚠️ Error message
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"
✅ Expected behavior
The project should start normally with all containers running.
❌ Actual behavior
The PostgreSQL container fails to start due to a data directory structure mismatch.
🔁 Steps to reproduce
- Clone the repository
- Run the project (e.g.
make up)
- Observe PostgreSQL container failure
🧠 Possible cause
The current PostgreSQL Docker image (17+) expects a versioned data directory structure (e.g. /var/lib/postgresql).
However, an existing Docker volume appears to contain data using the old structure (/var/lib/postgresql/data), leading to incompatibility.
This suggests:
- update the container configuration to use
/var/lib/postgresql as the mount point
🧪 Environment
- Docker version: 4.45.0 (203075) Desktop
- OS: Mac OS
🐛 PostgreSQL container fails to start due to incompatible existing data directory
📄 Description
When starting the project locally, the PostgreSQL container fails to initialize due to an incompatible existing data directory.
This happens even without any explicit database version upgrade performed by the user.
✅ Expected behavior
The project should start normally with all containers running.
❌ Actual behavior
The PostgreSQL container fails to start due to a data directory structure mismatch.
🔁 Steps to reproduce
make up)🧠 Possible cause
The current PostgreSQL Docker image (17+) expects a versioned data directory structure (e.g.
/var/lib/postgresql).However, an existing Docker volume appears to contain data using the old structure (
/var/lib/postgresql/data), leading to incompatibility.This suggests:
/var/lib/postgresqlas the mount point🧪 Environment