Unable to connect to the database
Hi, I am quite new to Docker and I have trouble setting it up.
When I run docker compose up -d the web interface doesn't start.
When I run docker logs immich_server I see the following error:
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [NestFactory] Starting Nest application...
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +69ms
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] DownloadModule dependencies initialized +1ms
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] ConfigHostModule dependencies initialized +0ms
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] ConfigModule dependencies initialized +7ms
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 1 - 03/05/2023, 7:03:56 PM LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 1 - 03/05/2023, 7:04:06 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: Connection terminated due to connection timeout
at Connection.<anonymous> (/usr/src/app/node_modules/pg/lib/client.js:132:73)
at Object.onceWrapper (node:events:641:28)
at Connection.emit (node:events:527:28)
at Socket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:57:12)
at Socket.emit (node:events:527:28)
at TCP.<anonymous> (node:net:709:12)
23 Replies
can you bring all container down with
docker-compose down
then prune the containers docker prune container
after that delete the volumes docker volume prune
and finally bring everything back again docker-compose up
The issue persists after doing this
can you perform
docker ps
?CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0e6acbf5e2f0 altran1502/immich-proxy:release "/docker-entrypoint.…" 3 minutes ago Up 2 minutes 0.0.0.0:2283->8080/tcp, :::2283->8080/tcp immich_proxy
5f91e6d140f2 altran1502/immich-server:release "/bin/sh ./start-ser…" 3 minutes ago Up 13 seconds 3001/tcp immich_server
bf309507181b altran1502/immich-server:release "/bin/sh ./start-mic…" 3 minutes ago Up 13 seconds 3001/tcp immich_microservices
c320ceb66a91 postgres:14 "docker-entrypoint.s…" 3 minutes ago Up 2 minutes 5432/tcp immich_postgres
49a65b81caff altran1502/immich-machine-learning:release "python src/main.py" 3 minutes ago Up 13 seconds immich_machine_learning
f4fae3ed3cb8 altran1502/immich-web:release "/bin/sh ./entrypoin…" 3 minutes ago Up 2 minutes 3000/tcp immich_web
201b260dc82c redis:6.2 "docker-entrypoint.s…" 3 minutes ago Up 2 minutes 6379/tcp immich_redis
Hope its a bit readable like this lol
what is your setup look like?
can you post your docker-compose and .env
Hmm everything looking alright
Can you perform the 4 steps again and please take a screenshot of the output from each step




can you do
docker logs immich_server
?
now do
docker logs immich_postgres
hmm
unsure why the database shutdown right away after starting up
what system are you running Immich on?
An Ubuntu server
Ok I have an idea
Can you follow this step https://docs.docker.com/engine/install/linux-postinstall/
Docker Documentation
Linux post-installation steps for Docker Engine
Find the recommended Docker Engine post-installation steps for Linux users, including how to run Docker as a non-root user and more.
After you are done, perform the 4 steps above
with without
sudo
in your commandI have now tried this but it did not fix the issue
I have also tried reinstalling docker
Could it have to with the applications I am already running?
I run Jellyfin, Pihole and Transmission torrent client
Your
.env
file is in the folder where you are running the docker-compose up command, right?Yep