介绍

immich 是一个开源的相册管理软件,有配套的 web 端和手机 APP,其中 web 端只有英文,APP 支持中文。

immich 主要有以下功能:

  • 手机相册同步
  • 用户管理
  • 自然语言查询
  • 人脸识别
  • 图像分类
  • 分享
  • 收藏
  • 相册
  • 存档
  • 垃圾箱
  • 地图轨迹

这对于家庭用户来说足够了

准备

下载镜像和大模型文件
这里使用当前的最新版本v1.105.1 ,如果由于网络原因无法下载docker镜像和大模型,可以到网盘下载(注册后下载,这个网盘不限速)

大模型文件
https://www.123pan.com/s/hnbojv-kI3E.html 提取码:29in。

下载 2024.4测试可用 中的 immich的model-cache-2024.4测试可用.zip

docker镜像
https://www.123pan.com/s/hnbojv-oI3E.html 提取码:DrLG

导入镜像
将下载好的镜像导入到docker中(能出国的不需要此步骤)

安装

docker-compose.yml 在结尾

创建需要挂载的目录

  • immich_server 和 immich_microservices 的 /usr/src/app/upload 是存储照片和视频的目录
  • immich_machine_learning/cache 目录是存放机器学习模型的,建议使用固态硬盘
  • immich_postgres/var/lib/postgresql/data 目录是存放数据库数据的,建议使用固态硬盘

修改docker-compose.yml
根据实际挂载目录修改docker-compose-yml

将大模型文件放到容器的 /cache
比如我挂载了 /docker/immich/machine/model-cache/cache,那么实际的存放地址如下,其中 clip 是自然语言搜索,facial-recognition 是人脸识别,image-classification 是图像分类
0a39837151045e263bba8d55d8e5a4b9.png

820f632cfbc0b299627ac8b8c6d7c4e4.png

启动
使用 docker-compose up -ddocker compose up -d 启动即可

可以通过 http://ip:2283 访问

#
# WARNING: 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:v1.105.1
    command: ['start.sh', 'immich']
    volumes:
      - /volume2/immich:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:v1.105.1
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    command: ['start.sh', 'microservices']
    volumes:
      - /volume2/immich:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:v1.105.1
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - /volume1/docker/immich/machine/model-cache:/cache
    restart: always

  redis:
    container_name: immich_redis
    image: registry.hub.docker.com/library/redis:6.2-alpine
    restart: always

  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0
    environment:
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
      POSTGRES_DB: immich
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      - /volume1/docker/immich/postgres:/var/lib/postgresql/data
    restart: always
    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"]

volumes:
  model-cache: