LibrePhotos
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:latest4 container_name: librephotos-frontend5 restart: unless-stopped6 ports: 7 - "3000:3000"8 depends_on: 9 - backend1011 backend: 12 image: reallibrephotos/librephotos:latest13 container_name: librephotos-backend14 restart: unless-stopped15 environment: 16 SECRET_KEY: ${SECRET_KEY}17 BACKEND_HOST: backend18 DB_BACKEND: postgresql19 DB_NAME: librephotos20 DB_USER: librephotos21 DB_PASS: ${DB_PASSWORD}22 DB_HOST: db23 REDIS_HOST: redis24 ADMIN_EMAIL: ${ADMIN_EMAIL}25 ADMIN_USERNAME: admin26 ADMIN_PASSWORD: ${ADMIN_PASSWORD}27 volumes: 28 - librephotos_data:/data29 - /path/to/photos:/photos30 depends_on: 31 - db32 - redis3334 db: 35 image: postgres:15-alpine36 container_name: librephotos-db37 restart: unless-stopped38 environment: 39 POSTGRES_USER: librephotos40 POSTGRES_PASSWORD: ${DB_PASSWORD}41 POSTGRES_DB: librephotos42 volumes: 43 - librephotos_db:/var/lib/postgresql/data4445 redis: 46 image: redis:7-alpine47 container_name: librephotos-redis4849volumes: 50 librephotos_data: 51 librephotos_db: .env Template
.env
1SECRET_KEY=generate-long-random-key2DB_PASSWORD=changeme3ADMIN_EMAIL=admin@example.com4ADMIN_PASSWORD=changemeUsage Notes
- 1Docs: https://docs.librephotos.com/
- 2Frontend at http://localhost:3000, backend at :8001/api
- 3Login with configured admin credentials on first visit
- 4Scan photos: User > Scan Photos after mounting library
- 5Face recognition and object detection (resource intensive)
- 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 file2cat > docker-compose.yml << 'EOF'3services:4 frontend:5 image: reallibrephotos/librephotos-frontend:latest6 container_name: librephotos-frontend7 restart: unless-stopped8 ports:9 - "3000:3000"10 depends_on:11 - backend1213 backend:14 image: reallibrephotos/librephotos:latest15 container_name: librephotos-backend16 restart: unless-stopped17 environment:18 SECRET_KEY: ${SECRET_KEY}19 BACKEND_HOST: backend20 DB_BACKEND: postgresql21 DB_NAME: librephotos22 DB_USER: librephotos23 DB_PASS: ${DB_PASSWORD}24 DB_HOST: db25 REDIS_HOST: redis26 ADMIN_EMAIL: ${ADMIN_EMAIL}27 ADMIN_USERNAME: admin28 ADMIN_PASSWORD: ${ADMIN_PASSWORD}29 volumes:30 - librephotos_data:/data31 - /path/to/photos:/photos32 depends_on:33 - db34 - redis3536 db:37 image: postgres:15-alpine38 container_name: librephotos-db39 restart: unless-stopped40 environment:41 POSTGRES_USER: librephotos42 POSTGRES_PASSWORD: ${DB_PASSWORD}43 POSTGRES_DB: librephotos44 volumes:45 - librephotos_db:/var/lib/postgresql/data4647 redis:48 image: redis:7-alpine49 container_name: librephotos-redis5051volumes:52 librephotos_data:53 librephotos_db:54EOF5556# 2. Create the .env file57cat > .env << 'EOF'58SECRET_KEY=generate-long-random-key59DB_PASSWORD=changeme60ADMIN_EMAIL=admin@example.com61ADMIN_PASSWORD=changeme62EOF6364# 3. Start the services65docker compose up -d6667# 4. View logs68docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/librephotos/run | bashTroubleshooting
- 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
Shortcuts: C CopyF FavoriteD Download