Skip to main content

Immich Photo & Video Management

·
Docker Backup Solutions Pictures Immich Docker Compose Photo Management self-hosted
Table of Contents

📸 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 Configuration Details
#

🌍 Environment Variables
#

VariableDescription
UPLOAD_LOCATION=./libraryDirectory for storing uploaded files
DB_DATA_LOCATION=./postgresDirectory for database storage
IMMICH_VERSION=releaseDefines the version of Immich to use
DB_PASSWORD=postgresPostgreSQL connection password
DB_USERNAME=postgresPostgreSQL username
DB_DATABASE_NAME=immichPostgreSQL database name

📂 Volume Mounts
#

VolumeDescription
${UPLOAD_LOCATION}:/usr/src/app/uploadStores uploaded media files
${THUMB_LOCATION}:/usr/src/app/upload/thumbsStores generated thumbnails
${ENCODED_VIDEO_LOCATION}:/usr/src/app/upload/encoded-videoStores transcoded videos
${PROFILE_LOCATION}:/usr/src/app/upload/profileStores user profile images
${BACKUP_LOCATION}:/usr/src/app/upload/backupsStores backup files
${DB_DATA_LOCATION}:/var/lib/postgresql/dataStores PostgreSQL database files
/etc/localtime:/etc/localtime:roMaintains time synchronization
model-cache:/cacheCaches machine learning models

🔗 Networking
#

Port MappingFunction
2283:2283Immich server web interface

📜 My Docker Compose Configuration
#

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ${THUMB_LOCATION}:/usr/src/app/upload/thumbs
      - ${ENCODED_VIDEO_LOCATION}:/usr/src/app/upload/encoded-video
      - ${PROFILE_LOCATION}:/usr/src/app/upload/profile
      - ${BACKUP_LOCATION}:/usr/src/app/upload/backups
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - "2283:2283"
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false

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

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: "--data-checksums"
    volumes:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1
      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

volumes:
  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: ./library

  • DB_DATA_LOCATION:
    The location where your database files are stored.
    Default: ./postgres

  • TZ:
    The timezone setting for Immich. Uncomment the next line and change Etc/UTC to a valid timezone identifier from this list.
    Example:
    TZ=Europe/London

  • IMMICH_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.