在NAS中安裝 docker 版的 immich 相冊

筆記雜項,用於記錄一些雜項或筆記
回覆文章
dtchang
Site Admin
文章: 190
註冊時間: 2017-01-22, 16:54

在NAS中安裝 docker 版的 immich 相冊

文章 dtchang » 2026-02-09, 19:31

在NAS中安裝 docker 版的 immich 相冊

step0. 參考系統架構
/volume2/photo 為公共照片空間,設為 immich 的 media 載點

step1. 建立資料夾
/docker/immich-app
/docker/immich-app/library
/docker/immich-app/postgres

step2. 複制檔案到 /docker/immich-app 下
.env
docker-compose.yml

step3. 建立 docker (container manager) 專案 immich-app
step4. 使用現有的 docker-compose.yml 建立專案 (全部下一步即可)
step5. 開啟網頁 http://[ip]:2283/ (預設連接埠為 2283)

step6. 開始immich設定(只需設定好 email 和密碼)
step7. 點擊右上角(和google很像)人物\管理
step8. 設定影片轉碼設定
step9. 增加外部媒體,,增加目錄 /mnt/media/photos
step10. 掃描, 觀看 [任務佇列] 即可觀看目前的任務進度,如:AI 識別,...


======================================================
.env參考檔案內容: IMMICH_VERSION=release 選用當前最新版本

代碼: 選擇全部

# 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=./library

# 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=Etc/UTC

# The Immich version to use. You can pin this to a specific version like "v2.1.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
DB_PASSWORD=postgres

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
=================================
docker-compose.yml 檔案參考內容: (注意內縮要一致,不然會報錯)
- /volume2/photo:/mnt/media/photos:ro
這是加載的參考方式(/volume2/photo 掛載為 /media)
- DEVICE=/dev/dri/renderD128
指示使用 intel CPU 的核顯硬解功能

代碼: 選擇全部

#
# 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}
    devices:
      - /dev/dri:/dev/dri
    volumes:
      - ${UPLOAD_LOCATION}:/data
      - /etc/localtime:/etc/localtime:ro
      - /volume2/photo:/mnt/media/photos:ro
    environment:
      - DEVICE=/dev/dri/renderD128
    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 與 database 保持不變)

  redis:
    container_name: immich_redis
    image: docker.io/valkey/valkey:9@sha256:546304417feac0874c3dd576e0952c6bb8f06bb4093ea0c9ca303c73cf458f63
    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
    healthcheck:
      disable: false

volumes:
  model-cache:


回覆文章