# PhotoPrism

> AI-powered photo app for organizing your collection.

- Category: Media & Entertainment
- Difficulty: intermediate
- Components: photoprism, mariadb
- Tags: photoprism, photos, ai, gallery
- Source: https://docker.recipes/media/photoprism

## Overview

PhotoPrism is an AI-powered photo management application that combines machine learning capabilities with self-hosted privacy to organize and browse personal photo collections. Built with TensorFlow integration, PhotoPrism automatically tags photos, recognizes faces, and provides advanced search functionality including color-based queries and geographic mapping. Unlike cloud-based solutions, PhotoPrism gives users complete control over their photo data while delivering sophisticated features typically found only in commercial services. This deployment pairs PhotoPrism with MariaDB to provide robust database performance and reliability for metadata storage. MariaDB's enhanced storage engines and improved connection handling make it particularly well-suited for PhotoPrism's intensive indexing operations and concurrent user access patterns. The combination delivers superior performance compared to SQLite deployments, especially when processing large photo libraries or supporting multiple users simultaneously. This stack is ideal for photography enthusiasts, families with large photo collections, and professionals who need private photo hosting with advanced organizational capabilities. PhotoPrism's support for RAW file formats, combined with MariaDB's reliable transaction handling, ensures that valuable photo assets are properly indexed and searchable while maintaining data integrity throughout the AI processing pipeline.

## Features

- AI-powered automatic photo tagging using TensorFlow machine learning
- Advanced face recognition with clustering and name assignment capabilities
- RAW file format support for professional photography workflows
- Geographic mapping and location-based photo organization
- Color-based search functionality for finding photos by dominant colors
- Live Photo support for iOS and Android dynamic images
- WebDAV synchronization for mobile device photo backup
- MariaDB's Aria storage engine for crash-safe photo metadata storage

## Use cases

- Personal photo library management for families with thousands of photos
- Professional photographer portfolio organization with RAW file support
- Privacy-focused photo hosting alternative to Google Photos or iCloud
- Photography business client gallery sharing with album organization
- Home lab enthusiasts building comprehensive media management systems
- Organizations requiring on-premises photo storage with AI capabilities
- Travel photography organization with automatic location tagging

## Prerequisites

- Minimum 4GB RAM recommended for AI features and face recognition
- Available port 2342 for PhotoPrism web interface access
- Sufficient storage space for original photos plus generated thumbnails
- Basic understanding of photo file formats and metadata concepts
- Environment variables configured for admin and database passwords
- Docker host with adequate CPU for TensorFlow AI processing tasks

## docker-compose.yml

```yaml
services:
  photoprism:
    image: photoprism/photoprism:latest
    container_name: photoprism
    restart: unless-stopped
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined
    ports:
      - "2342:2342"
    environment:
      PHOTOPRISM_ADMIN_USER: admin
      PHOTOPRISM_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      PHOTOPRISM_SITE_URL: "http://localhost:2342/"
      PHOTOPRISM_DATABASE_DRIVER: mysql
      PHOTOPRISM_DATABASE_SERVER: mariadb:3306
      PHOTOPRISM_DATABASE_NAME: photoprism
      PHOTOPRISM_DATABASE_USER: photoprism
      PHOTOPRISM_DATABASE_PASSWORD: ${DB_PASSWORD}
    volumes:
      - photoprism_originals:/photoprism/originals
      - photoprism_storage:/photoprism/storage
    depends_on:
      - mariadb

  mariadb:
    image: mariadb:10
    container_name: photoprism-db
    restart: unless-stopped
    environment:
      MARIADB_ROOT_PASSWORD: ${DB_PASSWORD}
      MARIADB_DATABASE: photoprism
      MARIADB_USER: photoprism
      MARIADB_PASSWORD: ${DB_PASSWORD}
    volumes:
      - photoprism_db:/var/lib/mysql

volumes:
  photoprism_originals:
  photoprism_storage:
  photoprism_db:
```

## .env

```bash
ADMIN_PASSWORD=changeme
DB_PASSWORD=changeme
```

## Usage notes

- Docs: https://docs.photoprism.app/
- Access at http://localhost:2342 - login with configured credentials
- Index library: Library > Complete Scan to process photos
- AI features (faces, objects, colors) require 4GB+ RAM
- Mobile upload via PhotoSync (iOS/Android) or WebDAV
- Supports RAW formats, Live Photos, and video

## Troubleshooting

- Photos not appearing after upload: Run Library > Complete Scan to index new files into the database
- Face recognition not working: Ensure container has access to at least 4GB RAM for TensorFlow processing
- MariaDB connection errors on startup: Check that DB_PASSWORD environment variable matches between services
- Slow indexing performance: Increase Docker container memory allocation and verify storage I/O performance
- RAW files showing as unsupported: Install additional codec packages or verify PhotoPrism version supports your camera model
- WebDAV sync failing from mobile: Verify firewall rules allow port 2342 and check PHOTOPRISM_SITE_URL configuration

