- Attach volume backup:/backup
- Backup current DB
pg_dumpall -U $POSTGRES_USER > /backup/dump.sql
- delete postgres data volume
- Upgrade container version (new postgres data volume will be create)
- Restore
psql -U $POSTGRES_USER < /backup/dump.sql
- Detatch backup volume (if needed, we can keep it there for next upgrade)
- Delete backup volume if detact or
rm /backup/dump.sql
if keep the volume.