Upgrade postgres in Docker
Published by powerfulyang on Dec 19, 2022
如何升级 docker 中的 postgres 版本?
Backup
Use beblow command, replace yourService
with yourself container_name.
1
docker-compose exec yourService pg_dumpall -U postgres > 14.5.backup
Modify your postgres tag by using "15" instead of "14", then down your container.
1
docker-compose rm -s -v yourService
Boot the new DB - PostgreSQL 15.1 and Restore from backup
1 2
docker-compose up -d yourService cat 14.5.backup | docker-compose exec -T db psql -U postgres