docker.recipes

Immich Self-Hosted Photos

intermediate

Immich Google Photos alternative with ML.

Overview

Immich is a modern, self-hosted photo and video backup solution that provides a Google Photos-like experience while maintaining complete control over your personal media. Developed as a privacy-focused alternative to cloud photo services, Immich combines automatic mobile backup with advanced machine learning capabilities for face recognition, object detection, and intelligent search. Unlike commercial solutions that impose storage limits and privacy concerns, Immich gives users unlimited storage capacity on their own hardware with sophisticated features like timeline views, album sharing, and geotagged photo mapping. This deployment creates a complete Immich infrastructure using four specialized containers: immich-server handles the web interface and API operations, immich-machine-learning provides AI-powered face recognition and object detection, immich-db runs a PostgreSQL database with vector search extensions (pgvecto-rs) for storing metadata and enabling semantic search, and immich-redis manages caching and background job queues. The machine learning container operates independently to process photos for tagging and facial recognition without impacting the main server performance. This stack is ideal for families wanting to replace Google Photos, photographers managing large collections, or privacy-conscious users seeking complete control over their media. The combination of automatic mobile backup, advanced search capabilities, and multi-user support makes it particularly valuable for households or small teams who want professional-grade photo management without recurring subscription costs or data privacy compromises.

Key Features

  • Automatic mobile backup from iOS and Android apps with background synchronization
  • Machine learning-powered face recognition and object detection for intelligent photo organization
  • Vector-based semantic search using pgvecto-rs PostgreSQL extension for finding photos by content
  • Interactive timeline with memories feature showing photos from previous years
  • Geotagged photo mapping with location-based browsing and search
  • Multi-user support with individual libraries and shared album capabilities
  • Live photos support preserving motion from iPhone and compatible Android devices
  • Bulk metadata extraction and duplicate detection for existing photo libraries

Common Use Cases

  • 1Family photo backup replacing Google Photos with unlimited storage and privacy control
  • 2Professional photographer portfolio management with client access and album sharing
  • 3Small business asset management for storing product photos and marketing materials
  • 4Travel documentation with automatic geotagging and location-based photo organization
  • 5Homelab media server integration for comprehensive personal data sovereignty
  • 6Multi-generational family archive with face recognition connecting photos across decades
  • 7Photography enthusiast collection management with advanced search and tagging capabilities

Prerequisites

  • Minimum 4GB RAM recommended for machine learning processing and PostgreSQL operations
  • Port 2283 available for Immich web interface access
  • Sufficient storage space for photo uploads in the configured upload directory
  • Mobile device compatibility for iOS 12+ or Android 8+ for automatic backup features
  • Understanding of photo library organization for optimal initial setup and user management
  • Network access planning for mobile app connectivity and potential external access configuration

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 immich-server:
3 image: ghcr.io/immich-app/immich-server:release
4 container_name: immich-server
5 restart: unless-stopped
6 ports:
7 - "${IMMICH_PORT:-2283}:2283"
8 environment:
9 - DB_HOSTNAME=immich-db
10 - DB_USERNAME=${DB_USER}
11 - DB_PASSWORD=${DB_PASSWORD}
12 - DB_DATABASE_NAME=immich
13 - REDIS_HOSTNAME=immich-redis
14 volumes:
15 - ${UPLOAD_PATH:-./uploads}:/usr/src/app/upload
16 depends_on:
17 - immich-db
18 - immich-redis
19
20 immich-machine-learning:
21 image: ghcr.io/immich-app/immich-machine-learning:release
22 container_name: immich-ml
23 restart: unless-stopped
24 volumes:
25 - model_cache:/cache
26
27 immich-db:
28 image: tensorchord/pgvecto-rs:pg15-v0.2.0
29 container_name: immich-db
30 restart: unless-stopped
31 environment:
32 - POSTGRES_USER=${DB_USER}
33 - POSTGRES_PASSWORD=${DB_PASSWORD}
34 - POSTGRES_DB=immich
35 volumes:
36 - immich_db_data:/var/lib/postgresql/data
37
38 immich-redis:
39 image: redis:7-alpine
40 container_name: immich-redis
41 restart: unless-stopped
42
43volumes:
44 immich_db_data:
45 model_cache:

.env Template

.env
1# Immich Photos
2IMMICH_PORT=2283
3UPLOAD_PATH=./uploads
4DB_USER=immich
5DB_PASSWORD=immich_password

Usage Notes

  1. 1Immich at http://localhost:2283
  2. 2Download mobile apps for backup
  3. 3ML container for face recognition
  4. 4Uses pgvecto-rs for vector search

Individual Services(4 services)

Copy individual services to mix and match with your existing compose files.

immich-server
immich-server:
  image: ghcr.io/immich-app/immich-server:release
  container_name: immich-server
  restart: unless-stopped
  ports:
    - ${IMMICH_PORT:-2283}:2283
  environment:
    - DB_HOSTNAME=immich-db
    - DB_USERNAME=${DB_USER}
    - DB_PASSWORD=${DB_PASSWORD}
    - DB_DATABASE_NAME=immich
    - REDIS_HOSTNAME=immich-redis
  volumes:
    - ${UPLOAD_PATH:-./uploads}:/usr/src/app/upload
  depends_on:
    - immich-db
    - immich-redis
immich-machine-learning
immich-machine-learning:
  image: ghcr.io/immich-app/immich-machine-learning:release
  container_name: immich-ml
  restart: unless-stopped
  volumes:
    - model_cache:/cache
immich-db
immich-db:
  image: tensorchord/pgvecto-rs:pg15-v0.2.0
  container_name: immich-db
  restart: unless-stopped
  environment:
    - POSTGRES_USER=${DB_USER}
    - POSTGRES_PASSWORD=${DB_PASSWORD}
    - POSTGRES_DB=immich
  volumes:
    - immich_db_data:/var/lib/postgresql/data
immich-redis
immich-redis:
  image: redis:7-alpine
  container_name: immich-redis
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 immich-server:
5 image: ghcr.io/immich-app/immich-server:release
6 container_name: immich-server
7 restart: unless-stopped
8 ports:
9 - "${IMMICH_PORT:-2283}:2283"
10 environment:
11 - DB_HOSTNAME=immich-db
12 - DB_USERNAME=${DB_USER}
13 - DB_PASSWORD=${DB_PASSWORD}
14 - DB_DATABASE_NAME=immich
15 - REDIS_HOSTNAME=immich-redis
16 volumes:
17 - ${UPLOAD_PATH:-./uploads}:/usr/src/app/upload
18 depends_on:
19 - immich-db
20 - immich-redis
21
22 immich-machine-learning:
23 image: ghcr.io/immich-app/immich-machine-learning:release
24 container_name: immich-ml
25 restart: unless-stopped
26 volumes:
27 - model_cache:/cache
28
29 immich-db:
30 image: tensorchord/pgvecto-rs:pg15-v0.2.0
31 container_name: immich-db
32 restart: unless-stopped
33 environment:
34 - POSTGRES_USER=${DB_USER}
35 - POSTGRES_PASSWORD=${DB_PASSWORD}
36 - POSTGRES_DB=immich
37 volumes:
38 - immich_db_data:/var/lib/postgresql/data
39
40 immich-redis:
41 image: redis:7-alpine
42 container_name: immich-redis
43 restart: unless-stopped
44
45volumes:
46 immich_db_data:
47 model_cache:
48EOF
49
50# 2. Create the .env file
51cat > .env << 'EOF'
52# Immich Photos
53IMMICH_PORT=2283
54UPLOAD_PATH=./uploads
55DB_USER=immich
56DB_PASSWORD=immich_password
57EOF
58
59# 3. Start the services
60docker compose up -d
61
62# 4. View logs
63docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/immich-photos-stack/run | bash

Troubleshooting

  • Mobile app cannot connect to server: Verify port 2283 is accessible and check firewall settings, ensure UPLOAD_PATH directory has proper write permissions
  • Machine learning face recognition not working: Check that immich-machine-learning container has sufficient memory allocation and model_cache volume is properly mounted
  • Database connection errors in immich-server: Verify DB_USER and DB_PASSWORD environment variables match between immich-server and immich-db services
  • Slow photo upload and processing: Monitor Redis performance and consider increasing memory allocation for immich-redis container caching
  • Search functionality not finding photos: Ensure pgvecto-rs extension is properly loaded in PostgreSQL and vector indexing has completed for uploaded photos

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space