My Immich Setup#
This Immich setup runs in a Docker container to provide a self-hosted photo and video management solution. It includes essential services such as the Immich server, machine learning module, Redis, and PostgreSQL database.
My Docker Compose Configuration#
services:
immich-server:
container_name: immich_server # Immich main API/web service
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} # Immich server image
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload # Original uploads
- ${THUMB_LOCATION}:/usr/src/app/upload/thumbs # Generated thumbnails
- ${ENCODED_VIDEO_LOCATION}:/usr/src/app/upload/encoded-video # Transcoded videos
- ${PROFILE_LOCATION}:/usr/src/app/upload/profile # User profile images
- ${BACKUP_LOCATION}:/usr/src/app/upload/backups # Application backup artifacts
- /etc/localtime:/etc/localtime:ro # Use host timezone
env_file:
- .env # Load environment variables from .env file
ports:
- "2283:2283" # Immich web/API port
depends_on:
- redis # Cache/message broker service
- database # PostgreSQL database service
restart: always # Always restart on failure or reboot
healthcheck:
disable: false
immich-machine-learning:
container_name: immich_machine_learning # ML inference service
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} # ML service image
volumes:
- model-cache:/cache # Cache downloaded ML models
env_file:
- .env # Load shared environment values
restart: always # Always restart on failure or reboot
healthcheck:
disable: false
redis:
container_name: immich_redis # Redis cache service
image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5 # Pinned Redis image
healthcheck:
test: redis-cli ping || exit 1 # Basic Redis health probe
restart: always # Always restart on failure or reboot
database:
container_name: immich_postgres # PostgreSQL database service
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 # Postgres with vector extension
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD} # Database password
POSTGRES_USER: ${DB_USERNAME} # Database user
POSTGRES_DB: ${DB_DATABASE_NAME} # Database name
POSTGRES_INITDB_ARGS: "--data-checksums" # Enable data checksums at init
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data # Persistent database data
healthcheck:
test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1 # Check DB readiness
interval: 5m
start_interval: 30s
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 # Always restart on failure or reboot
volumes:
model-cache: # Named volume for ML model cache
Immich Environment Variables Configuration#
You can find documentation for all the supported environment variables in the official Immich documentation.
Configuration Variables#
UPLOAD_LOCATION:
The location where your uploaded files are stored.
Default:./libraryDB_DATA_LOCATION:
The location where your database files are stored.
Default:./postgresTZ:
The timezone setting for Immich. Uncomment the next line and changeEtc/UTCto a valid timezone identifier from this list.
Example:TZ=Europe/LondonIMMICH_VERSION:
The version of Immich to use.
Default:release
You can pin it to a specific version like"v1.71.0".DB_PASSWORD:
The connection secret for PostgreSQL.
Change this to a random password for security.
Ensure that only A-Za-z0-9 characters are used, without special characters or spaces.
Example:DB_PASSWORD=yourSecurePassword
Default Database Credentials#
The following credentials do not need to be changed unless you want to customize the setup:
- DB_USERNAME:
postgres - DB_DATABASE_NAME:
immich
Documentation Links#
This configuration ensures your Immich instance has the correct settings for file storage, database credentials, timezone, and version control.