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:
Immich-Postgres | 2025-08-22 10:06:45.875 UTC [756] LOG: could not send data to client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:06:45.875 UTC [756] FATAL: connection to client lost
Immich-Postgres | 2025-08-22 10:06:45.875 UTC [759] LOG: could not send data to client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:06:45.875 UTC [759] FATAL: connection to client lost
Immich-Postgres | 2025-08-22 10:06:45.881 UTC [762] LOG: could not receive data from client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:06:45.875 UTC [756] LOG: could not send data to client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:06:45.875 UTC [756] FATAL: connection to client lost
Immich-Postgres | 2025-08-22 10:06:45.875 UTC [759] LOG: could not send data to client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:06:45.875 UTC [759] FATAL: connection to client lost
Immich-Postgres | 2025-08-22 10:06:45.881 UTC [762] LOG: could not receive data from client: Connection reset by peer
65 Replies
Immich
Immich2mo ago
: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.
Hyphonical
HyphonicalOP2mo ago
My compose file looks like this, i stripped the comments:
services:
immich-server:
container_name: Immich-Server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
volumes:
- ${UPLOAD_LOCATION}:/data
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
depends_on:
- redis
- database
restart: unless-stopped
healthcheck:
disable: false
networks:
- Tunnel
labels:
- "dockflare.enable=true"
- "dockflare.hostname=immich.hypho.dev"
- "dockflare.service=http://Immich-Server:2283"

- "dockflare.access.policy=bypass"
- "dockflare.access.session_duration=24h"

immich-machine-learning:
container_name: Immich-Machine-Learning
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
volumes:
- model-cache:/cache
env_file:
- .env
restart: unless-stopped
healthcheck:
disable: false
networks:
- Tunnel

redis:
container_name: Immich-Redis
image: docker.io/valkey/valkey:8-bookworm@sha256:5b8f8c333bef895c925f56629d6ba90aea95a4f7391f62411e625267c600b19c
healthcheck:
test: redis-cli ping || exit 1
restart: unless-stopped
networks:
- Tunnel

database:
container_name: Immich-Postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:32324a2f41df5de9efe1af166b7008c3f55646f8d0e00d9550c16c9822366b4a
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
shm_size: 128mb
restart: unless-stopped
networks:
- Tunnel

volumes:
model-cache:

networks:
Tunnel:
external: true
services:
immich-server:
container_name: Immich-Server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
volumes:
- ${UPLOAD_LOCATION}:/data
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
depends_on:
- redis
- database
restart: unless-stopped
healthcheck:
disable: false
networks:
- Tunnel
labels:
- "dockflare.enable=true"
- "dockflare.hostname=immich.hypho.dev"
- "dockflare.service=http://Immich-Server:2283"

- "dockflare.access.policy=bypass"
- "dockflare.access.session_duration=24h"

immich-machine-learning:
container_name: Immich-Machine-Learning
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
volumes:
- model-cache:/cache
env_file:
- .env
restart: unless-stopped
healthcheck:
disable: false
networks:
- Tunnel

redis:
container_name: Immich-Redis
image: docker.io/valkey/valkey:8-bookworm@sha256:5b8f8c333bef895c925f56629d6ba90aea95a4f7391f62411e625267c600b19c
healthcheck:
test: redis-cli ping || exit 1
restart: unless-stopped
networks:
- Tunnel

database:
container_name: Immich-Postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:32324a2f41df5de9efe1af166b7008c3f55646f8d0e00d9550c16c9822366b4a
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
shm_size: 128mb
restart: unless-stopped
networks:
- Tunnel

volumes:
model-cache:

networks:
Tunnel:
external: true
And my .env file looks like this:
UPLOAD_LOCATION=/mnt/filen-photos

DB_DATA_LOCATION=./postgres

TZ=Europe/Brussels

IMMICH_VERSION=release

DB_PASSWORD=postgres

DB_USERNAME=postgres
DB_DATABASE_NAME=immich
UPLOAD_LOCATION=/mnt/filen-photos

DB_DATA_LOCATION=./postgres

TZ=Europe/Brussels

IMMICH_VERSION=release

DB_PASSWORD=postgres

DB_USERNAME=postgres
DB_DATABASE_NAME=immich
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
Hyphonical
HyphonicalOP2mo ago
When visiting the web ui i get greeted by this lovely screen.
No description
Hyphonical
HyphonicalOP2mo ago
I did once get past this to the setup wizard, but then i couldn't create an admin account.
OS: Ubuntu 24.04 LTS x86_64
Host: KVM/QEMU Standard PC (i440FX + PIIX, 1996) (pc-i440fx-7.2)
Kernel: Linux 6.8.0-31-generic
Uptime: 8 days, 20 hours, 25 mins
Packages: 1019 (dpkg)
Shell: bash 5.2.21
Display (QEMU Monitor): 1280x800 @ 75 Hz in 15\"
Terminal: /dev/pts/1
CPU: AMD Ryzen 7 3700X (6) @ 4.24 GHz
GPU: Unknown Device 1111 (VGA compatible)
Memory: 6.17 GiB / 7.75 GiB (80%)
Swap: Disabled
Disk (/): 78.18 GiB / 98.31 GiB (80%) - ext4
Local IP (eth0): 179.61.xxx.xx/24
Locale: en_US.UTF-8
OS: Ubuntu 24.04 LTS x86_64
Host: KVM/QEMU Standard PC (i440FX + PIIX, 1996) (pc-i440fx-7.2)
Kernel: Linux 6.8.0-31-generic
Uptime: 8 days, 20 hours, 25 mins
Packages: 1019 (dpkg)
Shell: bash 5.2.21
Display (QEMU Monitor): 1280x800 @ 75 Hz in 15\"
Terminal: /dev/pts/1
CPU: AMD Ryzen 7 3700X (6) @ 4.24 GHz
GPU: Unknown Device 1111 (VGA compatible)
Memory: 6.17 GiB / 7.75 GiB (80%)
Swap: Disabled
Disk (/): 78.18 GiB / 98.31 GiB (80%) - ext4
Local IP (eth0): 179.61.xxx.xx/24
Locale: en_US.UTF-8
Mraedis
Mraedis2mo ago
Not 100% sure but make sure there is an internal network too
bo0tzz
bo0tzz2mo ago
Please post all the logs as well
Hyphonical
HyphonicalOP2mo ago
Should i post it to a pastebin-like website? Oh wait, i can just upload, right...
Hyphonical
HyphonicalOP2mo ago
docker compose logs > Logs.txt
Hyphonical
HyphonicalOP2mo ago
This is with an internal network
Hyphonical
HyphonicalOP2mo ago
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.
Mraedis
Mraedis2mo ago
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
Hyphonical
HyphonicalOP2mo ago
Well, I am using rclone for it, so I suppose one of those could be correct
Mraedis
Mraedis2mo ago
Rclone is known to break things
Hyphonical
HyphonicalOP2mo ago
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
Mraedis
Mraedis2mo ago
.... Why would you read only the upload location
Hyphonical
HyphonicalOP2mo ago
Well, i didn't know it would make files there until 5 seconds ago
Mraedis
Mraedis2mo ago
It's not an ingest folder, that's external libraries Upload location is for nothing but writing to
Hyphonical
HyphonicalOP2mo ago
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
Mraedis
Mraedis2mo ago
Upload location is not a folder with existing pictures you mount
Mraedis
Mraedis2mo ago
Upload_location is where all the assets you upload through immich app or web go to Don't use /data for external libraries
Hyphonical
HyphonicalOP2mo ago
but Upload location can be the rclone mount no? Well, i would rather keep it read only
Mraedis
Mraedis2mo ago
Sure, but it's also known to cause problems 😛
Hyphonical
HyphonicalOP2mo ago
I see
Mraedis
Mraedis2mo ago
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
Hyphonical
HyphonicalOP2mo ago
Can i set the upload folder to ./upload?
Mraedis
Mraedis2mo ago
Sure, you know what the dot means I assume
Hyphonical
HyphonicalOP2mo ago
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:
Immich-Postgres | 2025-08-22 10:52:15.022 UTC [65] LOG: unexpected EOF on client connection with an open transaction
Immich-Postgres | 2025-08-22 10:52:26.114 UTC [81] LOG: incomplete message from client
Immich-Postgres | 2025-08-22 10:52:26.114 UTC [82] LOG: could not receive data from client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:52:26.114 UTC [82] LOG: unexpected EOF on client connection with an open transaction
Immich-Postgres | 2025-08-22 10:52:26.115 UTC [80] LOG: could not send data to client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:52:26.115 UTC [80] FATAL: connection to client lost
Immich-Postgres | 2025-08-22 10:52:26.115 UTC [70] LOG: could not receive data from client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:52:26.115 UTC [70] LOG: unexpected EOF on client connection with an open transaction
Immich-Postgres | 2025-08-22 10:52:26.117 UTC [79] LOG: could not receive data from client: Connection reset by pe
Immich-Postgres | 2025-08-22 10:52:15.022 UTC [65] LOG: unexpected EOF on client connection with an open transaction
Immich-Postgres | 2025-08-22 10:52:26.114 UTC [81] LOG: incomplete message from client
Immich-Postgres | 2025-08-22 10:52:26.114 UTC [82] LOG: could not receive data from client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:52:26.114 UTC [82] LOG: unexpected EOF on client connection with an open transaction
Immich-Postgres | 2025-08-22 10:52:26.115 UTC [80] LOG: could not send data to client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:52:26.115 UTC [80] FATAL: connection to client lost
Immich-Postgres | 2025-08-22 10:52:26.115 UTC [70] LOG: could not receive data from client: Connection reset by peer
Immich-Postgres | 2025-08-22 10:52:26.115 UTC [70] LOG: unexpected EOF on client connection with an open transaction
Immich-Postgres | 2025-08-22 10:52:26.117 UTC [79] LOG: could not receive data from client: Connection reset by pe
Mraedis
Mraedis2mo ago
This is with default compose? Just FYI there is no need to put every container on your tunnel, just immich-server
bo0tzz
bo0tzz2mo ago
Maybe try deleting the entire setup and starting from scratch with 0 changes Then customize bit by bit and see what breaks it
Hyphonical
HyphonicalOP2mo ago
Mraedis
Mraedis2mo ago
Remove your tunnel thing from everything but immich-server and add
networks:
- default
networks:
- default
To every container
Hyphonical
HyphonicalOP2mo ago
do i need to define that network at the bottom?
Mraedis
Mraedis2mo ago
I don't think so,
Hyphonical
HyphonicalOP2mo ago
I managed to create an admin account, but logging hasn't worked yet, i checked my browser console:
13:18:55.717 The resource at “http://179.61.xxx.xx:2283/_app/immutable/assets/OverpassMono.XkUhFDDw.ttf” preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly. 179.61.xxx.xx:2283
13:19:02.711 Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen.
register
13:19:28.547
[handleError]: Unable to create admin account TypeError: NetworkError when attempting to fetch resource. <empty string> CEAp7F-B.js:1:612
13:19:42.307 Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen.
login
13:19:57.577
Cookie warnings 6
13:19:57.577 Cookie “immich_is_authenticated” has been rejected because a non-HTTPS cookie can’t be set as “secure”. login
13:19:57.577 Cookie “immich_is_authenticated” has been rejected because a non-HTTPS cookie can’t be set as “secure”.
13:18:55.717 The resource at “http://179.61.xxx.xx:2283/_app/immutable/assets/OverpassMono.XkUhFDDw.ttf” preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly. 179.61.xxx.xx:2283
13:19:02.711 Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen.
register
13:19:28.547
[handleError]: Unable to create admin account TypeError: NetworkError when attempting to fetch resource. <empty string> CEAp7F-B.js:1:612
13:19:42.307 Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen.
login
13:19:57.577
Cookie warnings 6
13:19:57.577 Cookie “immich_is_authenticated” has been rejected because a non-HTTPS cookie can’t be set as “secure”. login
13:19:57.577 Cookie “immich_is_authenticated” has been rejected because a non-HTTPS cookie can’t be set as “secure”.
Mraedis
Mraedis2mo ago
That sounds like a proxy problem to me 👀
Hyphonical
HyphonicalOP2mo ago
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
Mraedis
Mraedis2mo ago
what are your VPS's specs? Immich can be quite bulky
Hyphonical
HyphonicalOP2mo ago
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
Mraedis
Mraedis2mo ago
FWIW the machine learning model alone can easily eat 2GB
Hyphonical
HyphonicalOP2mo ago
Damn
Mraedis
Mraedis2mo ago
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
Hyphonical
HyphonicalOP2mo ago
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
Mraedis
Mraedis2mo ago
Did you mount the external library as a volume? Next up would be to actually attribute it to a user (read the link 😛 )
Hyphonical
HyphonicalOP2mo ago
Like this?
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/data
- /etc/localtime:/etc/localtime:ro
- /mnt/filen-photos:/data:ro
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/data
- /etc/localtime:/etc/localtime:ro
- /mnt/filen-photos:/data:ro
Mraedis
Mraedis2mo ago
I totally said not to use /data
Hyphonical
HyphonicalOP2mo ago
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
Mraedis
Mraedis2mo ago
I don't think so because you have 2 volumes trying to mount to the same place ah sorry anyway read the link
Hyphonical
HyphonicalOP2mo ago
yeah totally
Hyphonical
HyphonicalOP2mo ago
Thanks man
Mraedis
Mraedis2mo ago
There's a GUI
bo0tzz
bo0tzz2mo ago
I'm just gonna repeat this 👀
Mraedis
Mraedis2mo ago
GUI setting you need to complete* No. 💢 (j/k)
Hyphonical
HyphonicalOP2mo ago
Of course it doesn't exist
Mraedis
Mraedis2mo ago
This is with
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/data
- /etc/localtime:/etc/localtime:ro
- /mnt/filen-photos:/mnt/data/filen-photos:ro
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/data
- /etc/localtime:/etc/localtime:ro
- /mnt/filen-photos:/mnt/data/filen-photos:ro
?
Hyphonical
HyphonicalOP2mo ago
it's media, not data for some reason
Mraedis
Mraedis2mo ago
idk where you mounted it 😛
Hyphonical
HyphonicalOP2mo ago
Me neither Anyways, it's scanning I think i can close the issue now Well, forum post for that matter
Mraedis
Mraedis2mo ago
Alright good luck /close will close the issue
Immich
Immich2mo ago
This thread has been closed. To re-open, use the button below.
Hyphonical
HyphonicalOP2mo ago
Thanks again 🙂
Immich
Immich2mo ago
This thread has been closed. To re-open, use the button below.

Did you find this page helpful?