前言

我有挺多图片的,想搭建个图片管理工具奈何没有服务器,也没有 Nas ,干脆就笔记本电脑上。
打算用 Windows 装个 Docker 再在里面装个 Immich 。
给位佬友们有什么好推荐的吗,最好就能放在托管平台上面的,但是我 不想花钱
别问为什么没有图片,懒得截。

环境

  • Windows 11

准备工作

  1. 开启电脑的功能 Hyper-V适用于 Linux 的 Windows 子系统和虚拟机平台
    1. 打开控制面板 -> 程序 -> 程序和功能 -> 启用或关闭 Windows 功能
    2. Hyper-V 和 适用于 Linux 的 Windows 子系统和虚拟机平台 (勾选)
  2. 去官网下载 Docker并安装 (速度有点慢自行想办法)
    1. 无脑点 OK 然后等
    2. 安装完成点 Close
    3. 在桌面找到蓝色小鲸鱼打开它
    4. Accept(同意) 一些协议
    5. 提示需要登陆,感觉没必要可以点右上角 Skip(跳过)
    6. 调查问卷 Skip(跳过) 就行
    7. 更改 Docker 语言
      1. 点击这里去下载汉化包
      2. 关闭Docker Desktop
      3. 在Docker安装目录找到app.asar文件并将其备份,防止出现意外。
        • Windows下默认为C:\Program Files\Docker\Docker\frontend\resources
        • Macos下默认为/Applications/Docker.app/Contents/MacOS/Docker Desktop.app/Contents/Resources
        • Ubuntu/Debian下默认为/opt/docker-desktop/resources
      4. 将下载的asar文件改名为app.asar后替换原文件
    8. 打开终端CMD输入 docker –version
      1
      2
      PS C:\Users\59974> docker --version
      Docker version 28.0.4, build b8034c0
    9. 安装成功

安装 Immich

  1. 新建 F:/web/immich 文件夹(全英文路径)
  2. 下载最新的配置文件,我写了个脚本双击运行即可 updatedownload.bat
    F:/web/immich/updatedownload.bat
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    @echo off

    REM 设置基地址
    set BASE_URL=https://github.com/immich-app/immich/releases/latest/download/

    REM 下载 docker-compose.yml 文件
    echo 正在下载 docker-compose.yml ...
    powershell -Command "Invoke-WebRequest -Uri '%BASE_URL%docker-compose.yml' -OutFile 'docker-compose.yml'"
    if %ERRORLEVEL% neq 0 (
    echo 下载 docker-compose.yml 失败!
    pause
    exit /b %ERRORLEVEL%
    )

    REM 下载 .env 文件
    echo 正在下载 .env 文件 ...
    powershell -Command "Invoke-WebRequest -Uri '%BASE_URL%example.env' -OutFile '.env'"
    if %ERRORLEVEL% neq 0 (
    echo 下载 .env 失败!
    pause
    exit /b %ERRORLEVEL%
    )

    REM 下载 hwaccel.ml.yml 文件
    echo 正在下载 hwaccel.ml.yml ...
    powershell -Command "Invoke-WebRequest -Uri '%BASE_URL%hwaccel.ml.yml' -OutFile 'hwaccel.ml.yml'"
    if %ERRORLEVEL% neq 0 (
    echo 下载 hwaccel.ml.yml 失败!
    pause
    exit /b %ERRORLEVEL%
    )

    REM 下载 hwaccel.transcoding.yml 文件
    echo 正在下载 hwaccel.transcoding.yml ...
    powershell -Command "Invoke-WebRequest -Uri '%BASE_URL%hwaccel.transcoding.yml' -OutFile 'hwaccel.transcoding.yml'"
    if %ERRORLEVEL% neq 0 (
    echo 下载 hwaccel.transcoding.yml 失败!
    pause
    exit /b %ERRORLEVEL%
    )

    REM 下载 prometheus.yml 文件
    echo 正在下载 prometheus.yml ...
    powershell -Command "Invoke-WebRequest -Uri '%BASE_URL%prometheus.yml' -OutFile 'prometheus.yml'"
    if %ERRORLEVEL% neq 0 (
    echo 下载 prometheus.yml 失败!
    pause
    exit /b %ERRORLEVEL%
    )

    echo 所有文件下载完成!
    pause
  3. 修改 F:/web/immich/.env 文件(你不想改数据库密码可跳过)
    F:/web/immich/.env
    1
    2
    3
    4
    5
    6
    7
      # 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
    + TZ=Asia/Shanghai
    # 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
    + DB_PASSWORD=密码
  4. 运行安装代码
    1
    docker compose up -d
  5. 打开 http://127.0.0.1:2283(本机IP地址),显示 欢迎使用 Immich 界面即部署成功。

进阶操作

1. 更改模型,及文件路径

  1. 映射外部相册文件夹,更改模型
    F:/web/immich/docker-compose.yml
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    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
    + extends:
    + file: hwaccel.transcoding.yml
    + service: nvenc # 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
    + - F:/together:/mnt/media:ro
    immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    - # 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, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    + extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    + file: hwaccel.ml.yml
    + service: cuda # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
    + - F:/web/model-cache:/cache
  2. 下载模型(自行配置SSH)
    1
    2
    3
    4
    5
    git clone https://huggingface.co/immich-app/buffalo_l
    git clone https://huggingface.co/immich-app/XLM-Roberta-Large-Vit-B-16Plus
    # 国内镜像
    git clone https://hf-mirror.com/immich-app/buffalo_l
    git clone https://hf-mirror.com/immich-app/XLM-Roberta-Large-Vit-B-16Plus
  3. 移动文件夹,树状图如下
    F:/web/model-cache
    1
    2
    3
    4
    5
    6
    7
    model-cache
    ├─clip
    │ └─XLM-Roberta-Large-Vit-B-16Plus
    │ ├─textual
    │ └─visual
    └─facial-recognition
    └─buffalo_l
  4. 跟之前一样,运行安装代码等待部署即可
    1
    docker compose up -d

2. 内网穿透

自己琢磨吧

3. 效果

结尾

至此,教程结束。希望对你有所帮助,有任何问题请在下方留言。可以关注我的 公众号以及订阅我的文章 ,感谢你的支持,是对我最大的动力,当然了,更多的是因为热爱。

本文参考