Skip to content

Postgres 18: VOLUME/PGDATA path change breaks existing mounts — docs/notes request #1370

@morgoved

Description

@morgoved

With Postgres 18 the Docker Official Image appears to have changed the expected mount target.
Observed behavior:

  • Mounting a volume at /var/lib/postgresql/data (the historical default) now fails at container start with a runc error like:
    “error mounting ... to rootfs at /var/lib/postgresql/data: ... no such file or directory”.
  • Mounting the same volume at /var/lib/postgresql works and the container starts fine.

Impact:

  • A huge amount of deployment tooling assumes /var/lib/postgresql/data by default:
    Helm charts, Kubernetes operators/manifests, Terraform/Ansible roles, docker-compose examples, CI templates, etc.
    This change breaks upgrades 17 → 18 with no action from users, often in production.

Requests:

  1. Document prominently in the README/release notes for 18+ that the recommended mount has changed to /var/lib/postgresql,
    plus a clear upgrade/migration note (including PGDATA defaults for 18).
  2. Provide a backward-compatibility path so that mounting at /var/lib/postgresql/data still works, e.g.:
    • Create the legacy directory in the image and allow either path to be a valid mountpoint; or
    • Add an entrypoint fallback that accepts both /var/lib/postgresql and /var/lib/postgresql/data; or
    • Provide an opt-in compat flag/tag/env (e.g. POSTGRES_COMPAT_MOUNT=1) that makes /var/lib/postgresql/data valid again; or
    • Ship a symlink that preserves the legacy target (if acceptable from a security/packaging standpoint).

This would greatly ease upgrades because so many ecosystems hard-code the legacy path.
Happy to provide exact error logs and minimal reproducer if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions