Migrating from Immich on NixOS to Immich Docker #15356
ChocolateLoverRaj
started this conversation in
Community Guides
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was testing out Immich on my server runing NixOS using the NixOS option. It works great.
However, as I transitioned from trying out Immich to actually running Immich with everyone in my family's photos, I decided to use Docker instead of NixOS for the following reasons:
Even though I was just "testing" Immich, I already had albums, shared links, and other people upload their photos to Immich (and I did not want them to go through the hassle of re-uploading any photos they might've moved from their phone to an external drive). So I decided to try to migrate the existing Immich on NixOS to Docker.
This took a long time and headache, so I'm posting a solution here for others to not have to spend so much time:
cd
These steps use the folder for the Docker Immich:
/mnt/immich
. Replace with your new folder.cd /mnt/immich
Docker config
Same as https://immich.app/docs/install/docker-compose/, but stop before
docker compose up -d
. I did not change the config at all. You can change it if u want, but you might have to change the following commands to use different paths.Migrate photo files
Migrate postgres
Wait for the
immich_postgres
to finish starting (you can check withdocker ps
).Then find the path to the newest database backup that was created by Immich (I had a backup from 2AM of the same day and I didn't make any changes since then. You can probably go into your NixOS Immich and create a backup job manually if needed. I tried manually creating a backup as described in https://immich.app/docs/administration/backup-and-restore#manual-backup-and-restore but it did not work.
Now we have to do an additional step (which I consider hacky, but it worked for me). The DB has absolute paths for files starting with
/var/lib/immich
. However, the Immich Docker uses/usr/src/app/upload
instead. You could changedocker-compose.yml
to use/var/lib/immich
instead of/usr/src/app/upload
. I tried it and it worked. But I don't want to risk it so I did not use that method. So the solution is to replace all the strings in postgres.sudo docker exec -it immich_postgres psql -U postgres -d immich
and then inside run (Warning: this command was generated by ChatGPT. Idk how postgres works. I tried this and it works.)
It took a really long time to run
Start Immich!
Advice
I would not recommend using NixOS option for running Immich (NixOS + Docker is fine) unless you're just trying it out or are fine with always using NixOS for Immich. Even with my instructions, It was hard for me to do the migration.
Beta Was this translation helpful? Give feedback.
All reactions