Docker-compose problem
I installed Immich as docker-compose on my Unraid server, so not through the CA apps.
My docker.img became 1 Tb large and therefore my cache file became full. In trying to find a solution, I deleted my docker.img and then rebuilt my unraid server, by reinstalling in CA all the 'previous apps'. Before the docker-compose installations, I did not have that. I retrieved Immich docker again and now when I open immich I have to log in again. I seem to have lost the database. What is the best thing to do now? The paths to my photo archive are still in tact. Can I get the database back somewhere? Do I need to log in with a new account? Will I then get my photos back (retaining metadata)?
Below is my docker-compose.yml and my .env file.
51 Replies
:wave: Hey @groet,
Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:.
References
- Container Logs:
docker compose logs
docs
- Container Status: docker ps -a
docs
- Reverse Proxy: https://immich.app/docs/administration/reverse-proxy
- Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJAChecklist
I have...
1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time).
2. :blue_square: read applicable release notes.
3. :blue_square: reviewed the FAQs for known issues.
4. :blue_square: reviewed Github for known issues.
5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy).
6. :blue_square: uploaded the relevant information (see below).
7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable
(an item can be marked as "complete" by reacting with the appropriate number)
Information
In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:
- Your docker-compose.yml and .env files.
- Logs from all the containers and their status (see above).
- All the troubleshooting steps you've tried so far.
- Any recent changes you've made to Immich or your system.
- Details about your system (both software/OS and hardware).
- Details about your storage (filesystems, type of disks, output of commands like
fdisk -l
and df -h
).
- The version of the Immich server, mobile app, and other relevant pieces.
- Any other information that you think might be relevant.
Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)
If this ticket can be closed you can use the /close
command, and re-open it later if needed.GitHub
immich-app immich · Discussions
Explore the GitHub Discussions forum for immich-app immich. Discuss code, ask questions & collaborate with the developer community.
FAQ | Immich
User
GitHub
Issues · immich-app/immich
High performance self-hosted photo and video management solution. - Issues · immich-app/immich
Your database was being stored in a docker volume, which you wiped out when you deleted docker.img
You'll want to restore from a backup
Shit, I don't have a backup I am afraid
You’ll have to reupload the images then, or use an external library if you don’t want to do that
You don’t have backups in the UPLOAD_LOCATION folder?
There should be database dumps inside UPLOAD_LOCATION unless you turned that off
Those should sort you out here but are not a complete backup; take this as a reminder to set those up
All my pics are now stored in /mnt/user/Media/Photos, I saw this:

That looks good!
When I go into the console of the database docker, I can't reach the upload file to restore the backup?
When I gave the command: gunzip < "/upload/backups/immich-db-backup-1736816400079.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
the docker says No such file
Do I need to do that in the Unraid console or in a console of the database docker?
(I am sorry, little bit noob in this area)
that’s unlikely to be the file path. You need to find it on your system and use that path
I see user media photos …
I gave the command in the console of Unraid with the exact path (outside the docker), it is running now:

See some errors
are you sure you reset the database before starting the restore?
And the immich container is not running

I don't know excactly what I am doing, I guess
You're not inside any location
and
rm -rf
just like that is very... wildThen do not
rm -rf
. Wtf.
Please be cautious with deleting files if you don't even know what you're doing/where you areI’m glad we don’t have a slash at the end of that variable 😅
Well, it's not
$DB_DATA_LOCATION
:Dyou can use "cd" to navigate to your Database folder and then run the rm -rf part again
it might be saver tho to use unraids file browser
since 7.0.0 it is build in now and can take care of a lot of things like changing premissions and deleting/creating folder etc.
thank you so much, I got it working again by doing the commands in the postgress docker console.
I am sorry to come back again, I need to restore a backup again and thought I knew the procedure, but did not write it down correctly
I have a docker compose installation on unraid of Immich
I have a new installation with an ampty database and want to restore my old database
I go into the console of the postgress docker container and give the command:
gunzip <"/usr/src/app/upload/backups/immich-db-backup-1737334800361.sql.gz"
|sed"s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g"
|dockerexec-i immich_postgres psql —username=postgres # Restore Backup
I'll get the answer: No such file
sh: 2: Syntax error: "|" unexpected
Dow I first need to copy the database backup somewhere in the database postgress docker?
This command should be run on the postgres host, not inside the container
How do I do that?
How to acces postgress host?
Huh
Aren't you already on there?
How else would you have gotten a shell in postgres?
I have unraid server and went into the postgress console shell
Yeah, so run it on your unraid server

I can't acces the backup location from within the Postgress docker, so I copied the database backup into /var/lib/postgresql/data/
Still, can't open the file
You're still running it in the postgres container
You have to run it on your unraid server.
So go to the shell of Unraid?
And how do I enter the postgress then?
You don't
The command has
| docker exec immich_postgres ...
in the end
You process it on the host and then pipe the data into the containerOk, I see lot of scrolling rules now....


This looks like your backup may be a bit messed up
Should I use a one from the day before?
Can you remove the docker exec part and share the first 20 lines of output?
So not:
gunzip <"/mnt/user/Media/Photos/backups/immich-db-backup-1737334800361.sql.gz"
|sed"s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g"
|dockerexec-i immich_postgres psql —username=postgres # Restore Backup
But:
gunzip <"/mnt/user/Media/Photos/backups/immich-db-backup-1737334800361.sql.gz"
|sed"s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g"
?
Yes
Btw there should be a space between docker and exec
docker exec
Otherwise that may also explain those logsIt is scrolling so quickly, I can't acces the first 20 lines
I see a lot of spaces missing, think that is the problem (I wanted to documentate it in AnyType and think that's why the spaces are missing, one moment
Pipe it into
| head -n 20
But if you entered it without a space that'd definitely be weirdThat was the problem:

No it is restoring again
now it is restoring I mean
Thank you so much!!
For the spacing tip! 😉
I wil make notes that I have to run it in the Unraid Shell
You have made may day
Fwiw that's all described in our docs as well
I cant always understand when I need to do stuff in the containers shell and when into unraid shell
And I did not had to paste the command in a program that deletes the spaces
It's all working now again