Immich server always falls back to hostname database even after full clean reinstall + correct config (WSL2 + Docker Desktop) — not a duplicate of hostname misconfiguration #7995

Closed
opened 2026-02-05 13:27:30 +03:00 by OVERLORD · 10 comments
Owner

Originally created by @girisahu143 on GitHub (Dec 5, 2025).

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

Issue Description

I am experiencing a persistent issue with Immich server ignoring correct database environment variables and always falling back to the internal hostname:

database

This results in:

Error: getaddrinfo EAI_AGAIN database
hostname: 'database'
This issue is NOT caused by misconfiguration, and NOT a duplicate of any previously reported hostname mistakes.

I have completely wiped and rebuilt the entire environment multiple times (details below), yet Immich server still logs:

Connecting to database at host: database

even though my docker-compose.yml explicitly sets:

DATABASE_HOST=postgres

The OS that Immich Server is running on

WIN11, Ubuntu 20.04.6 LTS

Version of Immich Server

NA

Version of Immich Mobile App

NA

Platform with the issue

  • Server
  • Web
  • Mobile

Device make and model

NA

Your docker-compose.yml content

services:
  immich-server:
    image: ghcr.io/immich-app/immich-server:release
    environment:
      DATABASE_HOST: postgres
      DATABASE_PORT: 5432
      DATABASE_NAME: ${POSTGRES_DB}
      DATABASE_USER: ${POSTGRES_USER}
      DATABASE_PASSWORD: ${POSTGRES_PASSWORD}
      REDIS_HOST: redis
      REDIS_PASSWORD: ${REDIS_PASSWORD}

Your .env content

POSTGRES_USER=immich
POSTGRES_PASSWORD=ImmichDBPass123
POSTGRES_DB=immich

REDIS_PASSWORD=RedisPass@123

TZ=Asia/Kolkata

LETSENCRYPT_EMAIL=youremail@example.com
DOMAIN=photos.example.com

Reproduction steps

...

Relevant log output


Additional information

No response

Originally created by @girisahu143 on GitHub (Dec 5, 2025). ### I have searched the existing issues, both open and closed, to make sure this is not a duplicate report. - [ ] Yes ### The bug Issue Description I am experiencing a persistent issue with Immich server ignoring correct database environment variables and always falling back to the internal hostname: database This results in: Error: getaddrinfo EAI_AGAIN database hostname: 'database' This issue is NOT caused by misconfiguration, and NOT a duplicate of any previously reported hostname mistakes. I have completely wiped and rebuilt the entire environment multiple times (details below), yet Immich server still logs: Connecting to database at host: database even though my docker-compose.yml explicitly sets: DATABASE_HOST=postgres ### The OS that Immich Server is running on WIN11, Ubuntu 20.04.6 LTS ### Version of Immich Server NA ### Version of Immich Mobile App NA ### Platform with the issue - [x] Server - [x] Web - [ ] Mobile ### Device make and model NA ### Your docker-compose.yml content ```YAML services: immich-server: image: ghcr.io/immich-app/immich-server:release environment: DATABASE_HOST: postgres DATABASE_PORT: 5432 DATABASE_NAME: ${POSTGRES_DB} DATABASE_USER: ${POSTGRES_USER} DATABASE_PASSWORD: ${POSTGRES_PASSWORD} REDIS_HOST: redis REDIS_PASSWORD: ${REDIS_PASSWORD} ``` ### Your .env content ```Shell POSTGRES_USER=immich POSTGRES_PASSWORD=ImmichDBPass123 POSTGRES_DB=immich REDIS_PASSWORD=RedisPass@123 TZ=Asia/Kolkata LETSENCRYPT_EMAIL=youremail@example.com DOMAIN=photos.example.com ``` ### Reproduction steps 1. 2. 3. ... ### Relevant log output ```shell ``` ### Additional information _No response_
Author
Owner

@github-actions[bot] commented on GitHub (Dec 5, 2025):

This issue has automatically been closed as it is likely a duplicate. We get a lot of duplicate threads each day, which is why we ask you in the template to confirm that you searched for duplicates before opening one. If you're sure this is not a duplicate, please leave a comment and we will reopen the thread if necessary.

@github-actions[bot] commented on GitHub (Dec 5, 2025): This issue has automatically been closed as it is likely a duplicate. We get a lot of duplicate threads each day, which is why we ask you in the template to confirm that you searched for duplicates before opening one. If you're sure this is not a duplicate, please leave a comment and we will reopen the thread if necessary.
Author
Owner

@girisahu143 commented on GitHub (Dec 5, 2025):

its not duplicate,

@girisahu143 commented on GitHub (Dec 5, 2025): its not duplicate,
Author
Owner

@bo0tzz commented on GitHub (Dec 5, 2025):

The env var names are DB_* not DATABASE_*.

@bo0tzz commented on GitHub (Dec 5, 2025): The env var names are DB_* not DATABASE_*.
Author
Owner

@girisahu143 commented on GitHub (Dec 5, 2025):

Could you please explain as I am novice in this > The env var names are DB_* not DATABASE_*.

@girisahu143 commented on GitHub (Dec 5, 2025): Could you please explain as I am novice in this > The env var names are DB_* not DATABASE_*.
Author
Owner

@jniklast commented on GitHub (Dec 6, 2025):

In your docker-compose.yml your database config variables are called DATABASE_HOST etc. but they need to be named DB_HOST and so on. Replace the DATABASE_ with DB_.
In other words: your config is not correct.

@jniklast commented on GitHub (Dec 6, 2025): In your docker-compose.yml your database config variables are called DATABASE_HOST etc. but they need to be named DB_HOST and so on. Replace the DATABASE_ with DB_. In other words: your config is not correct.
Author
Owner

@girisahu143 commented on GitHub (Dec 6, 2025):

Yes I have tried today to replace the database with db_host but the error is same.> In your docker-compose.yml your database config variables are called DATABASE_HOST etc. but they need to be named DB_HOST and so on. Replace the DATABASE_ with DB_.

In other words: your config is not correct.

@girisahu143 commented on GitHub (Dec 6, 2025): Yes I have tried today to replace the database with db_host but the error is same.> In your docker-compose.yml your database config variables are called DATABASE_HOST etc. but they need to be named DB_HOST and so on. Replace the DATABASE_ with DB_. > In other words: your config is not correct.
Author
Owner

@girisahu143 commented on GitHub (Dec 6, 2025):

.env

--- IMMICH PATHS ---

UPLOAD_LOCATION=./library
DB_DATA_LOCATION=./postgres

--- DATABASE CONFIG ---

Use only A-Z a-z 0-9 (NO special characters)

DB_PASSWORD=postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

--- IMMICH VERSION ---

IMMICH_VERSION=release

--- TIMEZONE ---

TZ=Asia/Kolkata

--- REDIS ---

REDIS_PASSWORD=redispass123

@girisahu143 commented on GitHub (Dec 6, 2025): .env # --- IMMICH PATHS --- UPLOAD_LOCATION=./library DB_DATA_LOCATION=./postgres # --- DATABASE CONFIG --- # Use only A-Z a-z 0-9 (NO special characters) DB_PASSWORD=postgres DB_USERNAME=postgres DB_DATABASE_NAME=immich # --- IMMICH VERSION --- IMMICH_VERSION=release # --- TIMEZONE --- TZ=Asia/Kolkata # --- REDIS --- REDIS_PASSWORD=redispass123
Author
Owner

@girisahu143 commented on GitHub (Dec 6, 2025):

Yml

version: "3.9"

services:
postgres:
image: postgres:15
container_name: immich_postgres
restart: unless-stopped
environment:
POSTGRES_USER: immich
POSTGRES_PASSWORD: ImmichDBPass123
POSTGRES_DB: immich
volumes:
- ./postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U immich"]
interval: 5s
timeout: 5s
retries: 5
networks:
- internal

redis:
image: redis:7
container_name: immich_redis
restart: unless-stopped
command: ["redis-server"]
networks:
- internal
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5

immich-server:
image: ghcr.io/immich-app/immich-server:release
container_name: immich_server
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
DB_HOST: postgres
DB_PORT: 5432
DB_USERNAME: immich
DB_PASSWORD: ImmichDBPass123
DB_DATABASE_NAME: immich
TZ: Asia/Kolkata
ports:
- "2283:3001"
networks:
- internal

immich-web:
image: ghcr.io/immich-app/immich-web:release
container_name: immich_web
restart: unless-stopped
depends_on:
- immich-server
environment:
IMMICH_SERVER_URL: "http://immich-server:3001"
ports:
- "3000:3000"
networks:
- internal

immich-machine-learning:
image: ghcr.io/immich-app/immich-machine-learning:release
container_name: immich_ml
restart: unless-stopped
depends_on:
- immich-server
networks:
- internal

networks:
internal:
driver: bridge

@girisahu143 commented on GitHub (Dec 6, 2025): Yml version: "3.9" services: postgres: image: postgres:15 container_name: immich_postgres restart: unless-stopped environment: POSTGRES_USER: immich POSTGRES_PASSWORD: ImmichDBPass123 POSTGRES_DB: immich volumes: - ./postgres:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U immich"] interval: 5s timeout: 5s retries: 5 networks: - internal redis: image: redis:7 container_name: immich_redis restart: unless-stopped command: ["redis-server"] networks: - internal healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 immich-server: image: ghcr.io/immich-app/immich-server:release container_name: immich_server restart: unless-stopped depends_on: postgres: condition: service_healthy redis: condition: service_healthy environment: DB_HOST: postgres DB_PORT: 5432 DB_USERNAME: immich DB_PASSWORD: ImmichDBPass123 DB_DATABASE_NAME: immich TZ: Asia/Kolkata ports: - "2283:3001" networks: - internal immich-web: image: ghcr.io/immich-app/immich-web:release container_name: immich_web restart: unless-stopped depends_on: - immich-server environment: IMMICH_SERVER_URL: "http://immich-server:3001" ports: - "3000:3000" networks: - internal immich-machine-learning: image: ghcr.io/immich-app/immich-machine-learning:release container_name: immich_ml restart: unless-stopped depends_on: - immich-server networks: - internal networks: internal: driver: bridge
Author
Owner

@bo0tzz commented on GitHub (Dec 6, 2025):

Your compose file is bizarrely outdated, where did you get it from?

@bo0tzz commented on GitHub (Dec 6, 2025): Your compose file is bizarrely outdated, where did you get it from?
Author
Owner

@girisahu143 commented on GitHub (Dec 8, 2025):

How can I solve the issue please help> Your compose file is bizarrely outdated, where did you get it from?

@girisahu143 commented on GitHub (Dec 8, 2025): How can I solve the issue please help> Your compose file is bizarrely outdated, where did you get it from?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#7995