Skip to content

PostgreSQL container fails when try to up #827

@LuizKrlz

Description

@LuizKrlz

🐛 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

  1. Clone the repository
  2. Run the project (e.g. make up)
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions