Running immich in docker

Fed up with the notifications from google that your disk space is getting full? Then host your own photos.google.com, but it’s called immich (image, duh). You’ll need a machine with docker installed and plenty of disk space for what you want to save.

Now, apart from your photos you’ll need 2 files, .env and docker-compose.yml. I’ve mounted a disk specifically for storing my data on /var/store/immich.Just need 4 subdirectories in there:

mkdir -p /var/store/immich/library
mkdir -p /var/store/immich/profile
mkdir -p /var/store/immich/thumbs
mkdir -p /var/store/immich/upload

Create a directory to hold your configuration (like /home/me/compose) and create 2 files, the first is .env (yes, the name starts with a ‘.’):

.env:
#You can find documentation for all the supported env variables at https://docs.immich.app/install/environment-variables
#The location where your uploaded files are stored
UPLOAD_LOCATION=/var/store/immich/upload

#The location where your database files are stored. Network shares are not supported for the database
DB_DATA_LOCATION=./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=CET

#The Immich version to use. You can pin this to a specific version like "v2.4.0"
IMMICH_VERSION=v2.4.0
DB_DATA_LOCATION=/var/lib/postgres/data

# 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
DB_PASSWORD=<the very secret password>

IMMICH_PROCESS_INVALID_IMAGES=true
IMMICH_TELEMETRY_INCLUDE=all

#The values below this line do not need to be changed
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

docker-compose.yml:

#
# WARNING: To install Immich, follow our guide: https://docs.immich.app/install/docker-compose
#
# 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: cpu # 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
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /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:commit-04898e4c653af9a31548a8002df9b4572cc4a4ae-rocm
  devices:
    - /dev/kfd
    - /dev/dri
  environment:
    - MACHINE_LEARNING_DEVICE_IDS=0,1
    - MACHINE_LEARNING_WORKERS=2
    - MACHINE_LEARNING_ENABLE_ROCM=true
  volumes:
    - model-cache:/cache
    - ${UPLOAD_LOCATION}:/usr/src/app/upload
  restart: always
  ports:
    - 3003:3003

redis:
  container_name: immich_redis
  image: docker.io/valkey/valkey:8-bookworm@sha256:fea8b3e67b15729d4bb70589eb03367bab9ad1ee89c876f54327fc7c6e618571
  healthcheck:
    test: redis-cli ping || exit 1
  restart: always

database:
  container_name: immich_postgres
  image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:bcf63357191b76a916ae5eb93464d65c07511da41e3bf7a8416db519b40b1c23
  environment:
    POSTGRES_PASSWORD: ${DB_PASSWORD}
    POSTGRES_USER: ${DB_USERNAME}
    POSTGRES_DB: ${DB_DATABASE_NAME}
    POSTGRES_INITDB_ARGS: '--data-checksums'
    # Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs
    DB_STORAGE_TYPE: 'HDD'
  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
    - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
  shm_size: 128mb
    restart: always

volumes:
  model-cache:

 

 run docker compose up -d and your immich server should be up & running. Connect to http://<serverip>:2283/

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

14 − five =