docker.recipes

LibrePhotos

advanced

Self-hosted photo management with AI features.

Overview

LibrePhotos is a self-hosted photo management platform that serves as a privacy-focused alternative to Google Photos, offering AI-powered features like facial recognition, object detection, and automatic photo organization. Originally developed as an open-source solution for users who want complete control over their photo libraries, LibrePhotos leverages machine learning models to automatically categorize and search through thousands of photos without sending data to external services. This Docker stack combines LibrePhotos with PostgreSQL for robust metadata storage and Redis for high-performance caching and task queue management. The PostgreSQL database handles complex relational queries for photo metadata, facial recognition data, and user management, while Redis accelerates the AI processing pipeline by caching face embeddings and managing background tasks for photo analysis. This combination provides photographers, families, and privacy-conscious users with a powerful alternative to cloud-based photo services, offering features like automatic face clustering, location-based organization, duplicate detection, and full-text search across photo metadata while maintaining complete data ownership and privacy.

Key Features

  • AI-powered facial recognition with automatic person clustering using deep learning models
  • Object and scene detection with automatic tagging based on image content analysis
  • PostgreSQL-backed metadata storage with JSONB support for flexible photo attributes and geospatial indexing
  • Redis-accelerated face embedding cache for sub-second similarity searches across photo collections
  • Automatic photo timeline generation with intelligent date/time extraction from EXIF data
  • Duplicate photo detection using perceptual hashing algorithms
  • Full-text search across photo metadata, locations, and AI-generated tags
  • Background task processing for batch photo analysis and thumbnail generation

Common Use Cases

  • 1Family photo archival with automatic face tagging and person-based photo organization
  • 2Photography enthusiasts managing large RAW and JPEG collections with metadata preservation
  • 3Small businesses organizing product photography with automatic object detection and tagging
  • 4Privacy-focused individuals migrating from Google Photos while retaining AI features
  • 5Home media servers providing Netflix-style photo browsing for household members
  • 6Digital asset management for creative agencies with AI-powered content discovery
  • 7Personal photo backup solutions with intelligent organization and search capabilities

Prerequisites

  • Docker host with minimum 4GB RAM (8GB+ recommended for AI processing)
  • 50GB+ available storage for photo library, database, and generated thumbnails
  • Port 3000 available for frontend web interface access
  • Basic understanding of photo management workflows and EXIF metadata concepts
  • CPU with AVX instruction set support for optimal machine learning model performance
  • Existing photo collection organized in accessible directory structure

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 frontend:
3 image: reallibrephotos/librephotos-frontend:latest
4 container_name: librephotos-frontend
5 restart: unless-stopped
6 ports:
7 - "3000:3000"
8 depends_on:
9 - backend
10
11 backend:
12 image: reallibrephotos/librephotos:latest
13 container_name: librephotos-backend
14 restart: unless-stopped
15 environment:
16 SECRET_KEY: ${SECRET_KEY}
17 BACKEND_HOST: backend
18 DB_BACKEND: postgresql
19 DB_NAME: librephotos
20 DB_USER: librephotos
21 DB_PASS: ${DB_PASSWORD}
22 DB_HOST: db
23 REDIS_HOST: redis
24 ADMIN_EMAIL: ${ADMIN_EMAIL}
25 ADMIN_USERNAME: admin
26 ADMIN_PASSWORD: ${ADMIN_PASSWORD}
27 volumes:
28 - librephotos_data:/data
29 - /path/to/photos:/photos
30 depends_on:
31 - db
32 - redis
33
34 db:
35 image: postgres:15-alpine
36 container_name: librephotos-db
37 restart: unless-stopped
38 environment:
39 POSTGRES_USER: librephotos
40 POSTGRES_PASSWORD: ${DB_PASSWORD}
41 POSTGRES_DB: librephotos
42 volumes:
43 - librephotos_db:/var/lib/postgresql/data
44
45 redis:
46 image: redis:7-alpine
47 container_name: librephotos-redis
48
49volumes:
50 librephotos_data:
51 librephotos_db:

.env Template

.env
1SECRET_KEY=generate-long-random-key
2DB_PASSWORD=changeme
3ADMIN_EMAIL=admin@example.com
4ADMIN_PASSWORD=changeme

Usage Notes

  1. 1Docs: https://docs.librephotos.com/
  2. 2Frontend at http://localhost:3000, backend at :8001/api
  3. 3Login with configured admin credentials on first visit
  4. 4Scan photos: User > Scan Photos after mounting library
  5. 5Face recognition and object detection (resource intensive)
  6. 6Google Photos alternative with similar clustering features

Individual Services(4 services)

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

frontend
frontend:
  image: reallibrephotos/librephotos-frontend:latest
  container_name: librephotos-frontend
  restart: unless-stopped
  ports:
    - "3000:3000"
  depends_on:
    - backend
backend
backend:
  image: reallibrephotos/librephotos:latest
  container_name: librephotos-backend
  restart: unless-stopped
  environment:
    SECRET_KEY: ${SECRET_KEY}
    BACKEND_HOST: backend
    DB_BACKEND: postgresql
    DB_NAME: librephotos
    DB_USER: librephotos
    DB_PASS: ${DB_PASSWORD}
    DB_HOST: db
    REDIS_HOST: redis
    ADMIN_EMAIL: ${ADMIN_EMAIL}
    ADMIN_USERNAME: admin
    ADMIN_PASSWORD: ${ADMIN_PASSWORD}
  volumes:
    - librephotos_data:/data
    - /path/to/photos:/photos
  depends_on:
    - db
    - redis
db
db:
  image: postgres:15-alpine
  container_name: librephotos-db
  restart: unless-stopped
  environment:
    POSTGRES_USER: librephotos
    POSTGRES_PASSWORD: ${DB_PASSWORD}
    POSTGRES_DB: librephotos
  volumes:
    - librephotos_db:/var/lib/postgresql/data
redis
redis:
  image: redis:7-alpine
  container_name: librephotos-redis

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 frontend:
5 image: reallibrephotos/librephotos-frontend:latest
6 container_name: librephotos-frontend
7 restart: unless-stopped
8 ports:
9 - "3000:3000"
10 depends_on:
11 - backend
12
13 backend:
14 image: reallibrephotos/librephotos:latest
15 container_name: librephotos-backend
16 restart: unless-stopped
17 environment:
18 SECRET_KEY: ${SECRET_KEY}
19 BACKEND_HOST: backend
20 DB_BACKEND: postgresql
21 DB_NAME: librephotos
22 DB_USER: librephotos
23 DB_PASS: ${DB_PASSWORD}
24 DB_HOST: db
25 REDIS_HOST: redis
26 ADMIN_EMAIL: ${ADMIN_EMAIL}
27 ADMIN_USERNAME: admin
28 ADMIN_PASSWORD: ${ADMIN_PASSWORD}
29 volumes:
30 - librephotos_data:/data
31 - /path/to/photos:/photos
32 depends_on:
33 - db
34 - redis
35
36 db:
37 image: postgres:15-alpine
38 container_name: librephotos-db
39 restart: unless-stopped
40 environment:
41 POSTGRES_USER: librephotos
42 POSTGRES_PASSWORD: ${DB_PASSWORD}
43 POSTGRES_DB: librephotos
44 volumes:
45 - librephotos_db:/var/lib/postgresql/data
46
47 redis:
48 image: redis:7-alpine
49 container_name: librephotos-redis
50
51volumes:
52 librephotos_data:
53 librephotos_db:
54EOF
55
56# 2. Create the .env file
57cat > .env << 'EOF'
58SECRET_KEY=generate-long-random-key
59DB_PASSWORD=changeme
60ADMIN_EMAIL=admin@example.com
61ADMIN_PASSWORD=changeme
62EOF
63
64# 3. Start the services
65docker compose up -d
66
67# 4. View logs
68docker 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/librephotos/run | bash

Troubleshooting

  • Face recognition not working: Ensure photos have clear faces and enable face detection in settings, check backend logs for model loading errors
  • High memory usage during photo scan: Reduce concurrent workers in backend environment or increase available RAM, face detection is memory-intensive
  • Photos not appearing after scan: Verify photo directory permissions and check for supported file formats (JPEG, PNG, TIFF, RAW)
  • Redis connection errors: Ensure Redis container is healthy and reachable, restart backend service if connection pool is exhausted
  • PostgreSQL connection timeout: Check database container resources and increase connection limits if handling large photo libraries
  • Slow thumbnail generation: Enable hardware acceleration if available or reduce thumbnail quality settings in backend configuration

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