imagegenius / docker-immich

Monolithic (Single) Docker Container for Immich
GNU General Public License v3.0
457 stars 26 forks source link
docker minimal monolithic photos self-hosted

imagegenius/immich

GitHub Release GitHub Package Repository Jenkins Build IG CI

Immich is a high performance self-hosted photo and video backup solution.

immich

Supported Architectures

We use Docker manifest for cross-platform compatibility. More details can be found on Docker's website.

To obtain the appropriate image for your architecture, simply pull ghcr.io/imagegenius/immich:latest. Alternatively, you can also obtain specific architecture images by using tags.

This image supports the following architectures:

Architecture Available Tag
x86-64 amd64-\<version tag>
arm64 arm64v8-\<version tag>
armhf

Version Tags

This image offers different versions via tags. Be cautious when using unstable or development tags, and read their descriptions carefully.

Tag Available Description
latest Latest Immich release.
noml Latest Immich release. Machine-learning is completely removed.
cuda Latest Immich release. Machine-learning supports cuda (Nvidia).
openvino Latest Immich release. Machine-learning supports openvino (Intel).

Application Setup

Access the WebUI at http://your-ip:8080. Follow the setup wizard to configure Immich.

[!IMPORTANT] This image is not officially supported by the Immich team.

Please read and accept the consiquences of using this heavily active (in development) project.

  • ⚠️ The project is under very active development.
  • ⚠️ Expect bugs and breaking changes.
  • ⚠️ Do not use the app as the only way to store your photos and videos.
  • ⚠️ Always follow 3-2-1 backup plan for your precious photos and videos!

as stated in the official readme.

Requirements

Docker Mod for Redis

SSL Connection for PostgreSQL

To use SSL, include a PostgreSQL URL in the DB_URL environment variable.

Hardware Acceleration

Intel Hardware Acceleration

To enable Intel Quicksync:

  1. Ensure container access to /dev/dri.
  2. Add /dev/dri to your Docker run command:

    docker run --device=/dev/dri:/dev/dri ...

To enable OpenVINO:

  1. Make sure your CPU supports OpenVINO
  2. Add --device-cgroup-rule='c 189:* rmw' and -p /dev/bus/usb:/dev/bus/usb to your Docker run command:

    docker run --device=/dev/dri --device-cgroup-rule='c 189:* rmw' -p /dev/bus/usb:/dev/bus/usb ...

Nvidia Hardware Acceleration

  1. Install the Nvidia container runtime as per these instructions.

  2. Create a new Docker container using the Nvidia runtime:

    • Use --runtime=nvidia and NVIDIA_VISIBLE_DEVICES=all in your Docker run command, or specify a particular GPU UUID instead of all.
    docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all
    • Alternatively, use --gpus=all to enable all GPUs.
    docker run --gpus=all ...

Importing Existing Libraries

Usage

Example snippets to start creating a container:

Docker Compose

---
services:
  immich:
    image: ghcr.io/imagegenius/immich:latest
    container_name: immich
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - DB_HOSTNAME=192.168.1.x
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_DATABASE_NAME=immich
      - REDIS_HOSTNAME=192.168.1.x
      - DB_PORT=5432 #optional
      - REDIS_PORT=6379 #optional
      - REDIS_PASSWORD= #optional
      - MACHINE_LEARNING_HOST=0.0.0.0 #optional
      - MACHINE_LEARNING_PORT=3003 #optional
      - MACHINE_LEARNING_WORKERS=1 #optional
      - MACHINE_LEARNING_WORKER_TIMEOUT=120 #optional
    volumes:
      - path_to_appdata:/config
      - path_to_photos:/photos
      - path_to_imports:/import:ro #optional
    ports:
      - 8080:8080
    restart: unless-stopped

# This container requires an external application to be run separately.
# By default, ports for the databases are opened, be careful when deploying it
# Redis:
  redis:
    image: redis
    ports:
      - 6379:6379
    container_name: redis
# PostgreSQL 14:
  postgres14:
    image: tensorchord/pgvecto-rs:pg14-v0.2.0
    ports:
      - 5432:5432
    container_name: postgres14
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: immich
    volumes:
      - path_to_postgres:/var/lib/postgresql/data

Docker CLI (Click here for more info)

docker run -d \
  --name=immich \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -e DB_HOSTNAME=192.168.1.x \
  -e DB_USERNAME=postgres \
  -e DB_PASSWORD=postgres \
  -e DB_DATABASE_NAME=immich \
  -e REDIS_HOSTNAME=192.168.1.x \
  -e DB_PORT=5432 `#optional` \
  -e REDIS_PORT=6379 `#optional` \
  -e REDIS_PASSWORD= `#optional` \
  -e MACHINE_LEARNING_HOST=0.0.0.0 `#optional` \
  -e MACHINE_LEARNING_PORT=3003 `#optional` \
  -e MACHINE_LEARNING_WORKERS=1 `#optional` \
  -e MACHINE_LEARNING_WORKER_TIMEOUT=120 `#optional` \
  -p 8080:8080 \
  -v path_to_appdata:/config \
  -v path_to_photos:/photos \
  -v path_to_imports:/import:ro `#optional` \
  --restart unless-stopped \
  ghcr.io/imagegenius/immich:latest

# This container requires an external application to be run separately.
# By default, ports for the databases are opened, be careful when deploying it
# Redis:
docker run -d \
  --name=redis \
  -p 6379:6379 \
  redis

# PostgreSQL 14:
docker run -d \
  --name=postgres14 \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=immich \
  -v path_to_postgres:/var/lib/postgresql/data \
  -p 5432:5432 \
  tensorchord/pgvecto-rs:pg14-v0.2.0

Parameters

To configure the container, pass variables at runtime using the format <external>:<internal>. For instance, -p 8080:80 exposes port 80 inside the container, making it accessible outside the container via the host's IP on port 8080.

Parameter Function
-p 8080 WebUI Port
-e PUID=1000 UID for permissions - see below for explanation
-e PGID=1000 GID for permissions - see below for explanation
-e TZ=Etc/UTC Specify a timezone to use, see this list.
-e DB_HOSTNAME=192.168.1.x PostgreSQL Host
-e DB_USERNAME=postgres PostgreSQL Username
-e DB_PASSWORD=postgres PostgreSQL Password
-e DB_DATABASE_NAME=immich PostgreSQL Database Name
-e REDIS_HOSTNAME=192.168.1.x Redis Hostname
-e DB_PORT=5432 PostgreSQL Port
-e REDIS_PORT=6379 Redis Port
-e REDIS_PASSWORD= Redis password
-e MACHINE_LEARNING_HOST=0.0.0.0 Immich machine-learning host
-e MACHINE_LEARNING_PORT=3003 Immich machine-learning port
-e MACHINE_LEARNING_WORKERS=1 Machine learning workers
-e MACHINE_LEARNING_WORKER_TIMEOUT=120 Machine learning worker timeout
-v /config Contains machine learning models (~1.5GB with default models)
-v /photos Contains all the photos uploaded to Immich
-v /import:ro This folder will be periodically scanned, contents will be automatically imported into Immich

Umask for running applications

All of our images allow overriding the default umask setting for services started within the containers using the optional -e UMASK=022 option. Note that umask works differently than chmod and subtracts permissions based on its value, not adding. For more information, please refer to the Wikipedia article on umask here.

User / Group Identifiers

To avoid permissions issues when using volumes (-v flags) between the host OS and the container, you can specify the user (PUID) and group (PGID). Make sure that the volume directories on the host are owned by the same user you specify, and the issues will disappear.

Example: PUID=1000 and PGID=1000. To find your PUID and PGID, run id user.

  $ id username
    uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)

Updating the Container

Most of our images are static, versioned, and require an image update and container recreation to update the app. We do not recommend or support updating apps inside the container. Check the Application Setup section for recommendations for the specific image.

Instructions for updating containers:

Via Docker Compose

Via Docker Run

Versions