Docker搭建immich相册
获取docker compose文件和默认配置文件
$ mkdir ./immich
$ cd ./immich
$ wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
$ wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
修改.env
中的配置
UPLOAD_LOCATION是存放了用户上传的照片,以及自动生成的缩略图等,默认在当前目录的library下。
可都默认不用修改。
修改docker-compose.yml
主要修改docker镜像的地址,默认地址都是访问不到的。
另如何在windows上遇到启动不了postgresql, 需要修改volume加入权限。
文件diff如下:
--- docker-compose-original.yml 2025-02-25 17:36:12.927370800 +0800
+++ docker-compose.yml 2025-02-27 16:15:06.186136400 +0800
@@ -11,7 +11,7 @@
services:
immich-server:
container_name: immich_server
- image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
+ image: ghcr.nju.edu.cn/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
@@ -34,7 +34,7 @@
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:${IMMICH_VERSION:-release}
+ image: ghcr.nju.edu.cn/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, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
@@ -48,14 +48,14 @@
redis:
container_name: immich_redis
- image: docker.io/redis:6.2-alpine@sha256:905c4ee67b8e0aa955331960d2aa745781e6bd89afc44a8584bfd13bc890f0ae
+ image: docker.1ms.run/redis:6.2-alpine@sha256:905c4ee67b8e0aa955331960d2aa745781e6bd89afc44a8584bfd13bc890f0ae
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
+ image: docker.1ms.run/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
@@ -63,7 +63,7 @@
POSTGRES_INITDB_ARGS: '--data-checksums'
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
+ - ${DB_DATA_LOCATION}:/var/lib/postgresql/data && sudo chmod 0750 /var/lib/postgresql/data
healthcheck:
test: >-
pg_isready --dbname="$${POSTGRES_DB}" --username="$${POSTGRES_USER}" || exit 1;
运行
$ docker compose up -d
配置
浏览器运行http://localhost:2283
建议配置路径模板。