Skip to content

fix(docker): move Postgres volume mount to /var/lib/postgresql for 18+#11

Merged
bigpuritz merged 1 commit into
mainfrom
fix/8_postgres-18-volume-layout
Apr 28, 2026
Merged

fix(docker): move Postgres volume mount to /var/lib/postgresql for 18+#11
bigpuritz merged 1 commit into
mainfrom
fix/8_postgres-18-volume-layout

Conversation

@bigpuritz
Copy link
Copy Markdown
Contributor

Summary

Postgres 18 image rejects the previous /var/lib/postgresql/data mount layout, so docker compose up -d from the repo root fails — breaking the quick-start documented in the root README.md.

This PR mirrors the upstream fix from plugwerk/plugwerk#293 (commit cb00cfe): mount the volume at /var/lib/postgresql instead, with the same explanatory comment pointing at docker-library/postgres#1259.

The volume name (pgdata) is intentionally kept to avoid an unnecessary rename for existing local volumes.

Diff

```diff
volumes:

  •  - pgdata:/var/lib/postgresql/data
    
  •  # postgres:18+ requires the volume at /var/lib/postgresql (not /var/lib/postgresql/data)
    
  •  # so PGDATA can live in a major-version-specific subdirectory alongside config.
    
  •  # See https://github.com/docker-library/postgres/pull/1259.
    
  •  - pgdata:/var/lib/postgresql
    

```

Migration note for existing local volumes

Any `examples_pgdata` volume created before this fix is unusable with Postgres 18 and should be removed once:

```bash
docker compose down -v # or: docker volume rm examples_pgdata
```

No data loss concern — the previous setup never successfully ran with PG 18, so the volume only contains demo data from earlier PG versions, if anything.

Test plan

  • `docker compose up -d` on an empty volume → `examples-postgres-1 Healthy`, server `/actuator/health` returns `{"status":"UP"}`.
  • `docker exec examples-postgres-1 ls /var/lib/postgresql/` shows the expected `18/` subdir.
  • `docker compose down` (no `-v`) followed by `docker compose up -d` → data persists, server comes back up cleanly.

Closes #8
Relates to plugwerk/plugwerk#293

Postgres 18 image rejects the previous /var/lib/postgresql/data layout and
fails to start, breaking the docker compose up -d quick-start documented in
the root README.

Mirrors the upstream fix from plugwerk/plugwerk#293 (commit cb00cfe). The
volume name (pgdata) is intentionally kept to avoid forcing existing local
volumes through an unnecessary rename.

Verified locally:
- docker compose up -d on an empty volume reaches Postgres Healthy and
  server /actuator/health UP; /var/lib/postgresql/18 is created as expected.
- docker compose down (no -v) followed by up persists data and brings the
  server back up cleanly.

Closes #8
Relates to plugwerk/plugwerk#293

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bigpuritz bigpuritz added the bug Something isn't working label Apr 28, 2026
@bigpuritz bigpuritz merged commit 0b9a434 into main Apr 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker-compose: Postgres 18 image rejects current data volume mount layout

1 participant