Skip to content

Commit c7fd1f0

Browse files
committed
Upgrade PostgreSQL from 16.1 to 18.0
It was necessary to change the postgres-data path. Otherwise we got this error: Error: 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 c18224d commit c7fd1f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.devcontainer/compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ services:
3333
- redis-data:/data
3434

3535
postgres:
36-
image: postgres:16.1
36+
image: postgres:18.0
3737
restart: unless-stopped
3838
networks:
3939
- default
4040
volumes:
41-
- postgres-data:/var/lib/postgresql/data
41+
- postgres-data:/var/lib/postgresql
4242
environment:
4343
POSTGRES_USER: postgres
4444
POSTGRES_PASSWORD: postgres

0 commit comments

Comments
 (0)