Skip to content

Commit 835b34c

Browse files
Add upgrade note about PGDATA data loss bug fixed in 2.55.4
PostgreSQL 18 changed its default PGDATA path, causing data to be written to the container's ephemeral layer instead of the Docker volume.
1 parent 0502eec commit 835b34c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • docs/content/releases/os_upgrading

docs/content/releases/os_upgrading/2.51.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ If you already have a valid backup of the postgres 16 database, you can start at
7777

7878
_Note: If you are using a bound volume, the path has changed for Postgres18. It is now `/var/lib/postgresql/` instead of `/var/lib/postgresql/data`. Failure to change the path may result in errors about failure to create a shim task. See the discussion in [docker-library/postgres](https://github.com/docker-library/postgres/issues/1370)._
7979

80+
> **Warning: Data loss after `docker compose down` (fixed in 2.55.4)**
81+
>
82+
> PostgreSQL 18 changed its default `PGDATA` path from `/var/lib/postgresql/data` to `/var/lib/postgresql/18/docker`. Because the Docker volume was mounted at `/var/lib/postgresql/data`, data was written to the container's ephemeral layer instead of the volume.
83+
>
84+
> This has been fixed in 2.55.4 by explicitly setting `PGDATA: /var/lib/postgresql/data` in `docker-compose.yml`.
85+
>
86+
> If you customise the postgres service in your own `docker-compose.override.yml`, make sure `PGDATA` is set to the path where your volume is mounted.
87+
8088
### 0. Backup
8189

8290
Always back up your data before starting and save it somewhere.

0 commit comments

Comments
 (0)