Postgresql
First, create the new volume to new version
docker volume create postgres-XX
In docker-compose
add in volume the section with the new volume.
In service duplicate the postgres section, append version
start the new empty database, import new data like:
docker-compose exec --user postgres -i postgres16 pg_dumpall | docker-compose exec --user postgres -T postgres psql
Then remove old DB in docker-compose.yml, clean volume etc.