PostgreSQL Major Upgrade
This guide is for the PostgreSQL container from PLANKA's docker-compose.yml. PLANKA works with PostgreSQL 15 or newer, so nothing forces you to do this until your version reaches end of life.
If you run PostgreSQL yourself, follow the PostgreSQL upgrade documentation.
Do not just change the image tag. A major version cannot read the data directory of another one: the container keeps restarting with database files are incompatible with server. Your data is not lost, and setting the old tag again brings it back.
Create a backup before you start.
The commands below go from 16 to 18. From the folder with your docker-compose.yml:
-
Export All Databases
docker compose exec -T postgres pg_dumpall -U postgres > planka-postgres.sql -
Stop the Stack
docker compose downDo not add
-v: that would delete the volumes. -
Edit
docker-compose.ymlChange the image and give it a new volume:
services:postgres:image: postgres:18-alpinevolumes:- db-data-18:/var/lib/postgresqlvolumes:data:db-data:db-data-18:warningStarting with PostgreSQL 18, the image expects its volume at
/var/lib/postgresql. For 17 and older, keep/var/lib/postgresql/data. -
Start PostgreSQL and Import
docker compose up -d --wait postgresdocker compose exec -T postgres psql -U postgres < planka-postgres.sqlTwo errors are expected and harmless:
role "postgres" already existsanddatabase "planka" already exists. -
Start PLANKA
docker compose up -d -
Clean Up
Once you have checked that everything is there, remove the export and the old volume. The volume name starts with your Compose project name:
rm planka-postgres.sqldocker volume rm planka_db-dataRemove
db-data:from yourdocker-compose.ymlafterwards.