published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted in category Systems Software / Postgres
posted at 04. Jun '20
last updated at 12. May '21
Howto Upgrade Postgres (in Docker)
This process has downtime. Using docker-compose
in this scenario.
- Dump the database (
pg_dumpall --user postgres > dump10.1-2020-06-04.sql
, or user root) docker-compose down
- Back up physical files (only needed if everything goes to hell -
tar -cvpzf postgresfiles10.1-2020-06-04.tar.gz /var/lib/path-to-db-files
) - UPGRADE POSTGRES VERSION IN DOCKER-COMPOSE.YML
docker-compose up db
(start only db container, not other stuff)- Another terminal
docker exec -it hash-of-db-container /bin/bash
(find out hash withdocker ps
) cat data/dump10.1-2020-06-04.sql | psql --user postgres
- load dump to newer version of postgres- Stop it and run the whole app
Detailed info https://www.postgresql.org/docs/10/upgrading.html.
Add Comment