Restore immich-db-backup-12345.sql.gz to Immich-App

Does anyone knows how to restore a immich-db-backup-12345.sql.gz dump-file to the immich app?
My immich-app is not starting any more. After giving the app a new dataset for the Postgres Data Storage, I can start up the app again, but it’s like a fresh instillation.
I have a dump.sql.gz from the database from yesterday.

Here are the infos for Restore from the immich docs
docker compose down -v  # CAUTION! Deletes all Immich data to start from scratch
## Uncomment the next line and replace DB_DATA_LOCATION with your Postgres path to permanently reset the Postgres database
# rm -rf DB_DATA_LOCATION # CAUTION! Deletes all Immich data to start from scratch
docker compose pull             # Update to latest version of Immich (if desired)
docker compose create           # Create Docker containers for Immich apps without running them
docker start immich_postgres    # Start Postgres server
sleep 10                        # Wait for Postgres server to start up
# Check the database user if you deviated from the default
gunzip < "/path/to/backup/dump.sql.gz" \
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| docker exec -i immich_postgres psql --username=postgres  # Restore Backup
docker compose up -d            # Start remainder of Immich apps

How can this be done for immich under TrueNAS?

I installed now a new instance of immich on dockge and tried to restore the backup.
I get the following error:

psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory. Is the server running locally and accepting connection on that socket?

Maybe somebody has a hint for me to restore the backup.

Solution:

ERROR: option “locale_provider” not recognized

This means that the backup was made with a newer version of Postgres (>= 15), not version 14.

Immich is using this image:

image: prodrigestivill/postgres-backup-local:14

To recover a backup, made under the TrueNAS-App under dockge you have to switch the Immich DB to

image: tensorchord/pgvecto-rs:pg16-v0.2.0

While Immich ships with pg14, Postgres v16 is also supported.