docker-immich
docker-immich copied to clipboard
DB_HOSTNAME change
I installed it through Docker Compose, but when I restart Docker, the IP addresses obtained by immich, Redis, and postgres sometimes change, causing it to not start. How to modify Docker Compose to automatically adapt to this IP change for immich
you can set the ip to the hostname of the container, the hostname should be the container_name, eg:
services:
immich:
image: ghcr.io/imagegenius/igpipepr-immich:1.91.4-PR-266
container_name: immich
environment:
PUID: '1000'
PGID: '1000'
TZ: 'Australia/Melbourne'
DB_HOSTNAME: 'postgres14' # <= container name
DB_USERNAME: 'postgres'
DB_PASSWORD: 'postgres'
DB_DATABASE_NAME: 'immich'
REDIS_HOSTNAME: 'redis'
DB_PORT: '5432'
REDIS_PORT: '6379'
REDIS_PASSWORD: ''
MACHINE_LEARNING_WORKERS: '1'
MACHINE_LEARNING_WORKER_TIMEOUT: '120'
ports:
- '8080:8080'
restart: unless-stopped
depends_on:
- postgres14
- redis
redis:
image: redis
ports:
- '6379:6379'
container_name: redis
restart: unless-stopped
postgres14:
image: tensorchord/pgvecto-rs:pg14-v0.1.11
ports:
- '5432:5432'
container_name: postgres14 # <= set here
environment:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'postgres'
POSTGRES_DB: 'immich'
restart: unless-stopped
There is another issue, after Docker runs normally for a long time, Postgres will report an error and CPU usage will be high This is the latest error message: 2023-12-23 17:10:44.868 UTC [4580] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds' 2023-12-23 17:10:50.003 UTC [4582] ERROR: relation "socket_io_attachments" does not exist at character 13 2023-12-23 17:10:50.003 UTC [4582] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds' 2023-12-23 17:11:14.869 UTC [4584] ERROR: relation "socket_io_attachments" does not exist at character 13 2023-12-23 17:11:14.869 UTC [4584] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds' 2023-12-23 17:11:20.004 UTC [4586] ERROR: relation "socket_io_attachments" does not exist at character 13 2023-12-23 17:11:20.004 UTC [4586] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds' 2023-12-23 17:11:44.869 UTC [4589] ERROR: relation "socket_io_attachments" does not exist at character 13 2023-12-23 17:11:44.869 UTC [4589] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds' 2023-12-23 17:11:50.005 UTC [4591] ERROR: relation "socket_io_attachments" does not exist at character 13 2023-12-23 17:11:50.005 UTC [4591] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds' 2023-12-23 17:12:14.870 UTC [4593] ERROR: relation "socket_io_attachments" does not exist at character 13 2023-12-23 17:12:14.870 UTC [4593] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds' 2023-12-23 17:12:20.011 UTC [4595] ERROR: relation "socket_io_attachments" does not exist at character 13 2023-12-23 17:12:20.011 UTC [4595] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'