If you have photos and videos scattered across devices and cloud services, Immich can help. It’s a self-hosted media library that organizes, categorizes, and makes your media searchable—without relying on Big Tech like Google or Apple.
In this guide, I’ll walk you through setting up Immich using Docker Compose, focusing on its machine learning (ML) and database backends. Let’s get started.
What Makes Immich Special?
- Machine Learning Magic: Automatically tags and categorizes your media.
- Fast Search: Thanks to Redis and Postgres with vector-based indexing.
- Privacy First: Self-hosted means you own your data.
The Docker Compose File
Here’s the setup you need to get Immich running. This configuration is tailored to the latest release for maximum compatibility:
name: immich
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
ports:
- '2283:2283'
depends_on:
- redis
- database
restart: always
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
redis:
container_name: immich_redis
image: docker.io/redis:6.2-alpine
restart: always
database:
container_name: immich_postgres
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
restart: always
volumes:
model-cache:
Step-by-Step Guide
Step 1: Set Up Your Environment
- Install Docker and Docker Compose: Make sure your server is ready for containers.
- Download the Latest Docker Compose File: Use the official release to avoid compatibility issues.
- Create a
.env
File: Define key environment variables like:
UPLOAD_LOCATION=/path/to/media/uploads
DB_PASSWORD=your_db_password
DB_USERNAME=your_db_username
DB_DATABASE_NAME=immich
DB_DATA_LOCATION=/path/to/db/data
Step 2: Deploy Immich
Run the following command:
docker-compose up -d
The services will start in the background, pulling the required images and setting up the containers.
Step 3: Access Immich
- Navigate to
http://<your-server-ip>:2283
in your browser. - Log in or set up your first user.
Behind the Scenes
- Immich Server: Handles API requests and serves the web interface.
- Machine Learning Backend: Tags and categorizes your media for easy searchability.
- Redis: Speeds up processing with caching.
- Postgres: Stores metadata and integrates vector-based indexing for smart searches.
- Enable Hardware Acceleration:
If your server has GPUs, leverage hardware acceleration for transcoding and ML tasks. Adjust theimage
tags in the compose file accordingly. - Secure with HTTPS:
Use a reverse proxy like Traefik or Caddy to secure your Immich instance with SSL. - Periodic Backups:
Schedule backups forUPLOAD_LOCATION
andDB_DATA_LOCATION
to ensure your data is safe.
Why Immich?
With Immich, you get the power of Google Photos minus the privacy concerns. From auto-tagging to blazing-fast search, it’s like the ultimate solution for anyone serious about their media collection.
Ready to declutter your digital life? Deploy Immich today! 🚀