sudo docker-compose pull
sudo docker-compose exec [service_name_of_postgres] pg_dumpall -U [postgres_user] > /tmp/dump.sql
sudo docker-compose down
sudo docker volume rm [volume_name_of_postgres_data]
sudo docker-compose up -d
sudo cp /tmp/dump.sql /var/lib/docker/volumes/[volume_name_of_postgres_data]/_data/
sudo docker-compose exec [service_name_of_postgres] bash
cd /var/lib/postgresql/data/
psql -U [postgres_user] < dump.sql
The password needs to be set because version 13 used md5 algorithm and version 14 uses newer SCRAM-SHA-256 algorithm.
psql -U gitea
\password
# Enter the password at the prompt!
exit
exit