I had already installed immich on another server here: 7 Immich

So all that needed to happen was a migration over to my docker host.

First, I did a backup of my old database:

docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=postgres | gzip > "/path/to/backup/dump.sql.gz"

I then scp’d over my immich-app folder

scp -r immich-data 192.168.2.6:/home/tommy/

I deleted the database folder from that scp’d thing, so that the restore would work properly. I am unsure if this is necessary or not.

I also edited the .env file in that directory, and changed the username so that paths worked properly, as tommy was not the name of my user on the other server.

Then, I did a restore.

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