Skip to content

Commit 2505e2a

Browse files
Mount postgres volumes at /var/lib/postgresql
This is to resolve errors like the following, now that postgres:latest resolves to the v18 image by default. ```quote in 18+, these Docker images are configured to store database data in a format which is compatible with "pg_ctlcluster" (specifically, using major-version-specific directory names). This better reflects how PostgreSQL itself works, and how upgrades are to be performed. See also docker-library/postgres#1259 Counter to that, 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" (which requires both versions). The suggested container configuration for 18+ is to place a single mount at /var/lib/postgresql which will then place PostgreSQL data in a subdirectory, allowing usage of "pg_upgrade --link" without mount point boundary issues. See docker-library/postgres#37 for a (long) discussion around this process, and suggestions for how to do so. ```
1 parent f3a6d85 commit 2505e2a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

demos/nodejs-postgres-bucket-storage/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ services:
3535
- POSTGRES_PASSWORD=${PG_STORAGE_DATABASE_PASSWORD}
3636
- PGPORT=${PG_STORAGE_DATABASE_PORT}
3737
volumes:
38-
- pg_storage_data:/var/lib/postgresql/data
38+
- pg_storage_data:/var/lib/postgresql
3939
ports:
4040
- "${PG_STORAGE_DATABASE_PORT}:${PG_STORAGE_DATABASE_PORT}"
4141
healthcheck:

services/postgres.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
- POSTGRES_PASSWORD=${PG_DATABASE_PASSWORD}
99
- PGPORT=${PG_DATABASE_PORT}
1010
volumes:
11-
- pg_data:/var/lib/postgresql/data
11+
- pg_data:/var/lib/postgresql
1212
ports:
1313
- "${PG_DATABASE_PORT}:${PG_DATABASE_PORT}"
1414
command: ["postgres", "-c", "wal_level=logical"]

0 commit comments

Comments
 (0)