the docker compose files do not integrate well with your pre-existing docker compose setup #4665

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

Originally created by @stevekm on GitHub (Oct 31, 2024).

The bug

The included docker compose files are too complicated and are configured as if they are the only docker compose files you are going to be running on our system. For example, they make use of a .env file with extremely common variables such as DB_PASSWORD, DB_USERNAME, and the services in the docker-compose.yml file have overly generic service names such as "database", "redis", and the volume is labeled "model-cache".

It does not seem like its possible to use this at all if you already have a pretty hefty stack of other docker compose YAML files and services in your current docker compose configuration. For example, I already have multiple docker compose services that utilize databases, so a service from Immich labeled as database is not acceptable for use. Neither is a .env value of DB_PASSWORD since I already have other database passwords.

I made an attempt at trying to re-write the docker compose YAML from the latest release in a fashion that might work and be merged in with my current existing docker compose setup, however, it just ended up breaking everything. Keep in mind that in docker compose, you can only have a single .env file, so this means that if you have pre-existing configurations, you have no choice but to re-write the entire Immich docker compose setup in order to not have conflicts. Which is a pretty big blocker to usability.

This is something that I have only ever experienced with Immich. Other services were all pretty easy to add to my existing docker compose setup, for example you can see a ton of services available here https://docs.linuxserver.io/images/docker-flexget/ all with docker compose YAML's that dont need to be completely re-written to make them work with your existing docker compose stack.

The OS that Immich Server is running on

Debian GNU/Linux 12 (bookworm)

Version of Immich Server

release

Version of Immich Mobile App

none

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

This is the docker-compose.yml I had to re-write based on the version from `wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml` and then I had to import it from my parent primary docker-compose.yml file with this

---
include:
  # - a lot of other docker compose yaml files
  - immich/docker-compose.yml

-------

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

# name: immich
---
services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    extends:
      file: hwaccel.transcoding.yml
      service: nvenc # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    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
      - ${IMMICH_UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - '2283:2283'
    depends_on:
      - immich-redis
      - immich-database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-cuda
    extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
      file: hwaccel.ml.yml
      service: cuda # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - immich-model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false

  immich-redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  immich-database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${IMMICH_DB_PASSWORD}
      POSTGRES_USER: ${IMMICH_DB_USERNAME}
      POSTGRES_DB: ${IMMICH_DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${IMMICH_DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${IMMICH_DB_DATABASE_NAME}' --username='${IMMICH_DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${IMMICH_DB_DATABASE_NAME}' --username='${IMMICH_DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      # start_interval: 30s # https://github.com/docker-library/docker/issues/473 https://github.com/docker/compose/issues/11629
      start_period: 5m
    command:
      [
        'postgres',
        '-c',
        'shared_preload_libraries=vectors.so',
        '-c',
        'search_path="$$user", public, vectors',
        '-c',
        'logging_collector=on',
        '-c',
        'max_wal_size=2GB',
        '-c',
        'shared_buffers=512MB',
        '-c',
        'wal_compression=on',
      ]
    restart: always

volumes:
  immich-model-cache:

Your .env content

# SETTINGS FOR IMMICH, MERGED FROM THE immich/.env file
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
IMMICH_UPLOAD_LOCATION=/mnt/some_drive/apps/immich/uploads
# The location where your database files are stored
IMMICH_DB_DATA_LOCATION=/mnt/some_drive/apps/immich/database-postgres

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=EST

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
IMMICH_DB_PASSWORD=postgres

# The values below this line do not need to be changed
###################################################################################
IMMICH_DB_USERNAME=postgres
IMMICH_DB_DATABASE_NAME=immich

Reproduction steps

  1. I had to re-write the docker-compose.yml so it would not conflict with the pre-existing docker-compose.yml
  2. I had to re-write the .env file so it would not conflict with the pre-existing docker compose .env file
  3. docker compose up -d
  4. immich-server is broken and does not work

Relevant log output

immich_server  | Error: getaddrinfo ENOTFOUND redis
immich_server  |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {
immich_server  |   errno: -3008,
immich_server  |   code: 'ENOTFOUND',
immich_server  |   syscall: 'getaddrinfo',
immich_server  |   hostname: 'redis'
immich_server  | }


### Additional information

It would just be a lot easier if the docker compose YAML files could be provided in a manner that does not require re-writing them to make them work, which risks breaking everything as ended up here. Thanks.
Originally created by @stevekm on GitHub (Oct 31, 2024). ### The bug The included docker compose files are too complicated and are configured as if they are the only docker compose files you are going to be running on our system. For example, they make use of a `.env` file with extremely common variables such as `DB_PASSWORD`, `DB_USERNAME`, and the services in the docker-compose.yml file have overly generic service names such as "database", "redis", and the volume is labeled "model-cache". It does not seem like its possible to use this at all if you already have a pretty hefty stack of other docker compose YAML files and services in your current docker compose configuration. For example, I already have multiple docker compose services that utilize databases, so a service from Immich labeled as `database` is not acceptable for use. Neither is a .env value of `DB_PASSWORD` since I already have other database passwords. I made an attempt at trying to re-write the docker compose YAML from the latest release in a fashion that might work and be merged in with my current existing docker compose setup, however, it just ended up breaking everything. Keep in mind that in docker compose, you can only have a single `.env` file, so this means that if you have pre-existing configurations, you have no choice but to re-write the entire Immich docker compose setup in order to not have conflicts. Which is a pretty big blocker to usability. This is something that I have only ever experienced with Immich. Other services were all pretty easy to add to my existing docker compose setup, for example you can see a ton of services available here https://docs.linuxserver.io/images/docker-flexget/ all with docker compose YAML's that dont need to be completely re-written to make them work with your existing docker compose stack. ### The OS that Immich Server is running on Debian GNU/Linux 12 (bookworm) ### Version of Immich Server release ### Version of Immich Mobile App none ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML This is the docker-compose.yml I had to re-write based on the version from `wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml` and then I had to import it from my parent primary docker-compose.yml file with this --- include: # - a lot of other docker compose yaml files - immich/docker-compose.yml ------- # # WARNING: Make sure to use the docker-compose.yml of the current release: # # https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml # # The compose file on main may not be compatible with the latest release. # # name: immich --- services: immich-server: container_name: immich_server image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} extends: file: hwaccel.transcoding.yml service: nvenc # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding 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 - ${IMMICH_UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro env_file: - .env ports: - '2283:2283' depends_on: - immich-redis - immich-database restart: always healthcheck: disable: false immich-machine-learning: container_name: immich_machine_learning # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag. # Example tag: ${IMMICH_VERSION:-release}-cuda image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-cuda extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration file: hwaccel.ml.yml service: cuda # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable volumes: - immich-model-cache:/cache env_file: - .env restart: always healthcheck: disable: false immich-redis: container_name: immich_redis image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5 healthcheck: test: redis-cli ping || exit 1 restart: always immich-database: container_name: immich_postgres image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 environment: POSTGRES_PASSWORD: ${IMMICH_DB_PASSWORD} POSTGRES_USER: ${IMMICH_DB_USERNAME} POSTGRES_DB: ${IMMICH_DB_DATABASE_NAME} POSTGRES_INITDB_ARGS: '--data-checksums' volumes: # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file - ${IMMICH_DB_DATA_LOCATION}:/var/lib/postgresql/data healthcheck: test: pg_isready --dbname='${IMMICH_DB_DATABASE_NAME}' --username='${IMMICH_DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${IMMICH_DB_DATABASE_NAME}' --username='${IMMICH_DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1 interval: 5m # start_interval: 30s # https://github.com/docker-library/docker/issues/473 https://github.com/docker/compose/issues/11629 start_period: 5m command: [ 'postgres', '-c', 'shared_preload_libraries=vectors.so', '-c', 'search_path="$$user", public, vectors', '-c', 'logging_collector=on', '-c', 'max_wal_size=2GB', '-c', 'shared_buffers=512MB', '-c', 'wal_compression=on', ] restart: always volumes: immich-model-cache: ``` ### Your .env content ```Shell # SETTINGS FOR IMMICH, MERGED FROM THE immich/.env file # You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables # The location where your uploaded files are stored IMMICH_UPLOAD_LOCATION=/mnt/some_drive/apps/immich/uploads # The location where your database files are stored IMMICH_DB_DATA_LOCATION=/mnt/some_drive/apps/immich/database-postgres # To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List TZ=EST # The Immich version to use. You can pin this to a specific version like "v1.71.0" IMMICH_VERSION=release # Connection secret for postgres. You should change it to a random password # Please use only the characters `A-Za-z0-9`, without special characters or spaces IMMICH_DB_PASSWORD=postgres # The values below this line do not need to be changed ################################################################################### IMMICH_DB_USERNAME=postgres IMMICH_DB_DATABASE_NAME=immich ``` ### Reproduction steps 1. I had to re-write the docker-compose.yml so it would not conflict with the pre-existing docker-compose.yml 2. I had to re-write the .env file so it would not conflict with the pre-existing docker compose .env file 3. `docker compose up -d` 4. `immich-server` is broken and does not work ### Relevant log output ```shell immich_server | Error: getaddrinfo ENOTFOUND redis immich_server | at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) { immich_server | errno: -3008, immich_server | code: 'ENOTFOUND', immich_server | syscall: 'getaddrinfo', immich_server | hostname: 'redis' immich_server | } ``` ``` ### Additional information It would just be a lot easier if the docker compose YAML files could be provided in a manner that does not require re-writing them to make them work, which risks breaking everything as ended up here. Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#4665