Postgres: Connection reset by peer
Hey Immich. I recently decided to try out your amazing app. But I'm having some trouble launching for the first time. I'm using the recommended method to install and set up Immich, docker compose. I did make a couple modifications I do for every compose file, like linking it to my cloudflared tunnel system (network Tunnel), and using the label system from Dockflare. Like I said this is my first time using it, I expect no migrations from a database or anything. I'm not even sure what version (release) I'm launching...
When i check the logs i see a bunch of log messages from the Postgres Database, something about losing connection. This issue has been addressed in a recent dicussion, I just haven't found a solution yet. Do i downgrade everything using the environment file?
For context, this is what the error messages look like:
65 Replies
:wave: Hey @Hyphonical,
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_01GY0DAKGXDEHE263BCAYEGFJA
[Discussion] Immich server keeps restarting and disconnecting from postgres (immich-app/immich#20896)
Checklist
I have...
1. :ballot_box_with_check: verified I'm on the latest release(note that mobile app releases may take some time).
2. :ballot_box_with_check: read applicable release notes.
3. :ballot_box_with_check: reviewed the FAQs for known issues.
4. :ballot_box_with_check: reviewed Github for known issues.
5. :ballot_box_with_check: tried accessing Immich via local ip (without a custom reverse proxy).
6. :ballot_box_with_check: uploaded the relevant information (see below).
7. :ballot_box_with_check: 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.My compose file looks like this, i stripped the comments:
And my .env file looks like this:
I'm using rclone to mount my photos I exported from google photos to /mnt/filen-photos.
I have tried to use an external database from tensorchord's VectorChord, version 4.3
I have around 15 GB of storage free, but my rclone cache should get truncated soon, so then it's more like 21GB on my vps
When visiting the web ui i get greeted by this lovely screen.

I did once get past this to the setup wizard, but then i couldn't create an admin account.
Not 100% sure but make sure there is an internal network too
Please post all the logs as well
Should i post it to a pastebin-like website?
Oh wait, i can just upload, right...
docker compose logs > Logs.txt
This is with an internal network
I did just find this:
Immich-Server | [Nest] 7 - 08/22/2025, 12:36:12 PM ERROR [Microservices:StorageService] Failed to create /data/encoded-video/.immich: Error: ENOENT: no such file or directory, mkdir '/data/encoded-video'
Directory not created.Seems like your upload location wasn't properly mounted or is missing permissions
If you're sure it is now, remove the database to just start over
Well, I am using rclone for it, so I suppose one of those could be correct
Rclone is known to break things
I have it set to read only now, for security purposes, i now also see these things:
<UPLOAD_LOCATION>/encoded-video/.immich
can't create
.... Why would you read only the upload location
Well, i didn't know it would make files there until 5 seconds ago
It's not an ingest folder, that's external libraries
Upload location is for nothing but writing to
Wait, now I'm confused... Upload and the folder where my photos are, are the same right?
Okay, what if i set the upload location to ./data or ./upload, and mount /mnt/filen-photos to /data?
or something
Upload location is not a folder with existing pictures you mount
Upload_location is where all the assets you upload through immich app or web go to
Don't use /data for external libraries
but Upload location can be the rclone mount no?
Well, i would rather keep it read only
Sure, but it's also known to cause problems 😛
I see
Upload_location can absolutely not be read only, it has to be a writable empty folder
For mounting existing read only folders, see the external libraries link
Can i set the upload folder to ./upload?
Sure, you know what the dot means I assume
current directory
Well, i just made it to the admin setup screen again, i can't create an account though
might have to try a different browser
I still do see these errors:
This is with default compose?
Just FYI there is no need to put every container on your tunnel, just immich-server
Maybe try deleting the entire setup and starting from scratch with 0 changes
Then customize bit by bit and see what breaks it
Remove your tunnel thing from everything but immich-server and add
To every container
do i need to define that network at the bottom?
I don't think so,
I managed to create an admin account, but logging hasn't worked yet, i checked my browser console:
That sounds like a proxy problem to me 👀
I'm just directly accessing it with my vps's ip and the configured port. I don't do reverse proxies, only cloudflared if it would work.
5 seconds after the server is online it get's restarted. Then i get these messages in the logs:
immich_server | Initializing Immich v1.138.1
immich_server | Detected CPU Cores: 6
immich_server | Starting api worker
immich_server | Starting microservices worker
It's an endless loop
what are your VPS's specs?
Immich can be quite bulky
Here
Hmm, you're not wrong though, i do notice the ram going below 5% (usage is 95%). So i think OOM kills it
Let me check what other docker containers use a lot of ram
FWIW the machine learning model alone can easily eat 2GB
Damn
It's the bulkiest part
The easy way to test this is just comment out the machine-learning container
the rest will still work, albeit without smart search/facial recognition
Okay, yeah
It would appear to be runnign at the moment
I don't see any photos at the moment, i assume it's either scanning or i misconfigured something
Did you mount the external library as a volume?
Next up would be to actually attribute it to a user
(read the link 😛 )
Like this?
I totally said not to use /data
Yeah, it wasn't like that
i just changed it, it was /mnt/data/filen-photos before that
sorry
It's currently active with it mounted to /mnt/data/filen-photos
I don't think so because you have 2 volumes trying to mount to the same place
ah sorry
anyway read the link
yeah totally
Thanks man
There's a GUI
I'm just gonna repeat this 👀
GUI setting you need to complete*
No. 💢
(j/k)
Of course it doesn't exist
This is with
?
it's media, not data for some reason
idk where you mounted it 😛
Me neither
Anyways, it's scanning
I think i can close the issue now
Well, forum post for that matter
Alright good luck
/close
will close the issuehttps://zipline.hypho.dev/u/Tabby_JAPeECk8aO.png Looks right
This thread has been closed. To re-open, use the button below.
Thanks again 🙂
This thread has been closed. To re-open, use the button below.