Skip to content

Commit 0502eec

Browse files
Fix database data loss after docker compose down (fixes #14358)
PostgreSQL 18 changed the default PGDATA path from /var/lib/postgresql/data to /var/lib/postgresql/18/docker. The volume was mounted at the old path, so data was stored in the container's ephemeral layer instead. Setting PGDATA explicitly ensures data persists in the volume.
1 parent 49a15e2 commit 0502eec

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ services:
122122
postgres:
123123
image: postgres:18.1-alpine@sha256:4eb15de8e7b692c02427a2df278d18eb89422a534e428efb6d43c968250334d4
124124
environment:
125+
PGDATA: /var/lib/postgresql/data
125126
POSTGRES_DB: ${DD_DATABASE_NAME:-defectdojo}
126127
POSTGRES_USER: ${DD_DATABASE_USER:-defectdojo}
127128
POSTGRES_PASSWORD: ${DD_DATABASE_PASSWORD:-defectdojo}

0 commit comments

Comments
 (0)