docker.recipes

PhotoPrism + MariaDB + TensorFlow

intermediate

AI-powered photo management with face recognition.

Overview

PhotoPrism is an AI-powered photo management application that leverages TensorFlow for advanced image recognition, automatic tagging, and face detection. Originally developed as a privacy-focused alternative to Google Photos, PhotoPrism processes RAW files, organizes photos by location and date, and uses machine learning to classify images without sending data to external services. The application has gained popularity among photography enthusiasts and privacy-conscious users who want professional-grade photo management capabilities on their own infrastructure. This stack combines PhotoPrism's AI capabilities with MariaDB's robust database performance and TensorFlow's machine learning processing power. MariaDB serves as the metadata repository, storing image classifications, face recognition data, album information, and user preferences, while TensorFlow handles the computationally intensive tasks of image analysis, object detection, and facial recognition. The integration allows PhotoPrism to maintain fast search capabilities across large photo libraries while performing real-time AI analysis of newly uploaded images. Photographers, families with large digital photo collections, and organizations requiring private photo hosting will find this combination particularly valuable. The stack is ideal for users who need professional photo management features like RAW processing, GPS-based organization, and intelligent search, but want to maintain complete control over their data. Small creative agencies, photography studios, and tech-savvy households can deploy this to replace cloud photo services while gaining superior AI-powered organization capabilities.

Key Features

  • TensorFlow-powered automatic image classification and object recognition with over 1000 labels
  • Real-time face detection and clustering for organizing photos by people
  • RAW file processing support for professional photography formats (CR2, NEF, ARW, DNG)
  • GPS-based photo mapping with interactive world map visualization
  • Color-based image search and filtering using advanced color analysis
  • MariaDB optimized storage with InnoDB buffer pool configuration for fast metadata queries
  • WebDAV synchronization for automatic photo backup from mobile devices
  • Live photo support with video thumbnail generation and playback

Common Use Cases

  • 1Photography studios managing client photo collections with AI-powered organization
  • 2Families digitizing and organizing decades of photo archives with automatic face recognition
  • 3Content creators building searchable stock photo libraries with automatic tagging
  • 4Small businesses replacing Google Photos while maintaining AI search capabilities
  • 5Privacy-focused individuals hosting personal photo collections without cloud dependencies
  • 6Creative agencies organizing project assets with location and date-based categorization
  • 7Hobbyist photographers processing and cataloging RAW files with professional tools

Prerequisites

  • Minimum 4GB RAM (8GB recommended) for TensorFlow model processing and image analysis
  • Docker and Docker Compose installed with at least 20GB available storage space
  • Port 2342 available for PhotoPrism web interface access
  • Basic understanding of photo file formats and metadata for optimal configuration
  • CPU with adequate processing power for AI model inference (multi-core recommended)
  • Environment variables configured: ADMIN_USER, ADMIN_PASSWORD, MYSQL_USER, MYSQL_PASSWORD, MYSQL_ROOT_PASSWORD

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 photoprism:
3 image: photoprism/photoprism:latest
4 security_opt:
5 - seccomp:unconfined
6 - apparmor:unconfined
7 environment:
8 - PHOTOPRISM_ADMIN_USER=${ADMIN_USER}
9 - PHOTOPRISM_ADMIN_PASSWORD=${ADMIN_PASSWORD}
10 - PHOTOPRISM_AUTH_MODE=password
11 - PHOTOPRISM_SITE_URL=http://localhost:2342/
12 - PHOTOPRISM_ORIGINALS_LIMIT=5000
13 - PHOTOPRISM_HTTP_COMPRESSION=gzip
14 - PHOTOPRISM_LOG_LEVEL=info
15 - PHOTOPRISM_READONLY=false
16 - PHOTOPRISM_EXPERIMENTAL=false
17 - PHOTOPRISM_DISABLE_CHOWN=false
18 - PHOTOPRISM_DISABLE_WEBDAV=false
19 - PHOTOPRISM_DISABLE_SETTINGS=false
20 - PHOTOPRISM_DISABLE_TENSORFLOW=false
21 - PHOTOPRISM_DISABLE_FACES=false
22 - PHOTOPRISM_DISABLE_CLASSIFICATION=false
23 - PHOTOPRISM_DISABLE_RAW=false
24 - PHOTOPRISM_RAW_PRESETS=false
25 - PHOTOPRISM_JPEG_QUALITY=85
26 - PHOTOPRISM_DETECT_NSFW=false
27 - PHOTOPRISM_UPLOAD_NSFW=true
28 - PHOTOPRISM_DATABASE_DRIVER=mysql
29 - PHOTOPRISM_DATABASE_SERVER=mariadb:3306
30 - PHOTOPRISM_DATABASE_NAME=photoprism
31 - PHOTOPRISM_DATABASE_USER=${MYSQL_USER}
32 - PHOTOPRISM_DATABASE_PASSWORD=${MYSQL_PASSWORD}
33 working_dir: /photoprism
34 volumes:
35 - photoprism-originals:/photoprism/originals
36 - photoprism-storage:/photoprism/storage
37 ports:
38 - "2342:2342"
39 depends_on:
40 - mariadb
41 networks:
42 - photoprism-network
43 restart: unless-stopped
44
45 mariadb:
46 image: mariadb:10.11
47 security_opt:
48 - seccomp:unconfined
49 - apparmor:unconfined
50 command: --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
51 environment:
52 - MARIADB_AUTO_UPGRADE=1
53 - MARIADB_INITDB_SKIP_TZINFO=1
54 - MARIADB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
55 - MARIADB_DATABASE=photoprism
56 - MARIADB_USER=${MYSQL_USER}
57 - MARIADB_PASSWORD=${MYSQL_PASSWORD}
58 volumes:
59 - mariadb-data:/var/lib/mysql
60 networks:
61 - photoprism-network
62 restart: unless-stopped
63
64volumes:
65 photoprism-originals:
66 photoprism-storage:
67 mariadb-data:
68
69networks:
70 photoprism-network:
71 driver: bridge

.env Template

.env
1# PhotoPrism
2ADMIN_USER=admin
3ADMIN_PASSWORD=secure_admin_password
4MYSQL_ROOT_PASSWORD=secure_root_password
5MYSQL_USER=photoprism
6MYSQL_PASSWORD=secure_mysql_password

Usage Notes

  1. 1Web UI at http://localhost:2342
  2. 2Login with admin credentials
  3. 3Upload photos via web or WebDAV
  4. 4AI indexing runs automatically
  5. 5Face recognition enabled

Individual Services(2 services)

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

photoprism
photoprism:
  image: photoprism/photoprism:latest
  security_opt:
    - seccomp:unconfined
    - apparmor:unconfined
  environment:
    - PHOTOPRISM_ADMIN_USER=${ADMIN_USER}
    - PHOTOPRISM_ADMIN_PASSWORD=${ADMIN_PASSWORD}
    - PHOTOPRISM_AUTH_MODE=password
    - PHOTOPRISM_SITE_URL=http://localhost:2342/
    - PHOTOPRISM_ORIGINALS_LIMIT=5000
    - PHOTOPRISM_HTTP_COMPRESSION=gzip
    - PHOTOPRISM_LOG_LEVEL=info
    - PHOTOPRISM_READONLY=false
    - PHOTOPRISM_EXPERIMENTAL=false
    - PHOTOPRISM_DISABLE_CHOWN=false
    - PHOTOPRISM_DISABLE_WEBDAV=false
    - PHOTOPRISM_DISABLE_SETTINGS=false
    - PHOTOPRISM_DISABLE_TENSORFLOW=false
    - PHOTOPRISM_DISABLE_FACES=false
    - PHOTOPRISM_DISABLE_CLASSIFICATION=false
    - PHOTOPRISM_DISABLE_RAW=false
    - PHOTOPRISM_RAW_PRESETS=false
    - PHOTOPRISM_JPEG_QUALITY=85
    - PHOTOPRISM_DETECT_NSFW=false
    - PHOTOPRISM_UPLOAD_NSFW=true
    - PHOTOPRISM_DATABASE_DRIVER=mysql
    - PHOTOPRISM_DATABASE_SERVER=mariadb:3306
    - PHOTOPRISM_DATABASE_NAME=photoprism
    - PHOTOPRISM_DATABASE_USER=${MYSQL_USER}
    - PHOTOPRISM_DATABASE_PASSWORD=${MYSQL_PASSWORD}
  working_dir: /photoprism
  volumes:
    - photoprism-originals:/photoprism/originals
    - photoprism-storage:/photoprism/storage
  ports:
    - "2342:2342"
  depends_on:
    - mariadb
  networks:
    - photoprism-network
  restart: unless-stopped
mariadb
mariadb:
  image: mariadb:10.11
  security_opt:
    - seccomp:unconfined
    - apparmor:unconfined
  command: "--innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120"
  environment:
    - MARIADB_AUTO_UPGRADE=1
    - MARIADB_INITDB_SKIP_TZINFO=1
    - MARIADB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    - MARIADB_DATABASE=photoprism
    - MARIADB_USER=${MYSQL_USER}
    - MARIADB_PASSWORD=${MYSQL_PASSWORD}
  volumes:
    - mariadb-data:/var/lib/mysql
  networks:
    - photoprism-network
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 photoprism:
5 image: photoprism/photoprism:latest
6 security_opt:
7 - seccomp:unconfined
8 - apparmor:unconfined
9 environment:
10 - PHOTOPRISM_ADMIN_USER=${ADMIN_USER}
11 - PHOTOPRISM_ADMIN_PASSWORD=${ADMIN_PASSWORD}
12 - PHOTOPRISM_AUTH_MODE=password
13 - PHOTOPRISM_SITE_URL=http://localhost:2342/
14 - PHOTOPRISM_ORIGINALS_LIMIT=5000
15 - PHOTOPRISM_HTTP_COMPRESSION=gzip
16 - PHOTOPRISM_LOG_LEVEL=info
17 - PHOTOPRISM_READONLY=false
18 - PHOTOPRISM_EXPERIMENTAL=false
19 - PHOTOPRISM_DISABLE_CHOWN=false
20 - PHOTOPRISM_DISABLE_WEBDAV=false
21 - PHOTOPRISM_DISABLE_SETTINGS=false
22 - PHOTOPRISM_DISABLE_TENSORFLOW=false
23 - PHOTOPRISM_DISABLE_FACES=false
24 - PHOTOPRISM_DISABLE_CLASSIFICATION=false
25 - PHOTOPRISM_DISABLE_RAW=false
26 - PHOTOPRISM_RAW_PRESETS=false
27 - PHOTOPRISM_JPEG_QUALITY=85
28 - PHOTOPRISM_DETECT_NSFW=false
29 - PHOTOPRISM_UPLOAD_NSFW=true
30 - PHOTOPRISM_DATABASE_DRIVER=mysql
31 - PHOTOPRISM_DATABASE_SERVER=mariadb:3306
32 - PHOTOPRISM_DATABASE_NAME=photoprism
33 - PHOTOPRISM_DATABASE_USER=${MYSQL_USER}
34 - PHOTOPRISM_DATABASE_PASSWORD=${MYSQL_PASSWORD}
35 working_dir: /photoprism
36 volumes:
37 - photoprism-originals:/photoprism/originals
38 - photoprism-storage:/photoprism/storage
39 ports:
40 - "2342:2342"
41 depends_on:
42 - mariadb
43 networks:
44 - photoprism-network
45 restart: unless-stopped
46
47 mariadb:
48 image: mariadb:10.11
49 security_opt:
50 - seccomp:unconfined
51 - apparmor:unconfined
52 command: --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
53 environment:
54 - MARIADB_AUTO_UPGRADE=1
55 - MARIADB_INITDB_SKIP_TZINFO=1
56 - MARIADB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
57 - MARIADB_DATABASE=photoprism
58 - MARIADB_USER=${MYSQL_USER}
59 - MARIADB_PASSWORD=${MYSQL_PASSWORD}
60 volumes:
61 - mariadb-data:/var/lib/mysql
62 networks:
63 - photoprism-network
64 restart: unless-stopped
65
66volumes:
67 photoprism-originals:
68 photoprism-storage:
69 mariadb-data:
70
71networks:
72 photoprism-network:
73 driver: bridge
74EOF
75
76# 2. Create the .env file
77cat > .env << 'EOF'
78# PhotoPrism
79ADMIN_USER=admin
80ADMIN_PASSWORD=secure_admin_password
81MYSQL_ROOT_PASSWORD=secure_root_password
82MYSQL_USER=photoprism
83MYSQL_PASSWORD=secure_mysql_password
84EOF
85
86# 3. Start the services
87docker compose up -d
88
89# 4. View logs
90docker 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/photoprism-complete/run | bash

Troubleshooting

  • PhotoPrism shows 'TensorFlow not available' error: Ensure PHOTOPRISM_DISABLE_TENSORFLOW=false and container has sufficient memory allocated
  • Face recognition not working after photo upload: Check that PHOTOPRISM_DISABLE_FACES=false and run manual indexing from Settings > Library
  • MariaDB connection refused during startup: Wait for MariaDB container to fully initialize (can take 30-60 seconds on first run) before PhotoPrism connects
  • High CPU usage during photo indexing: Normal behavior when TensorFlow processes new images, reduce concurrent workers in advanced settings if needed
  • RAW files not displaying thumbnails: Verify PHOTOPRISM_DISABLE_RAW=false and ensure sufficient storage space for thumbnail generation
  • Database connection errors after restart: Check that mariadb-data volume persists and MARIADB_AUTO_UPGRADE=1 is set for schema updates

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

Components

photoprismmariadbtensorflow

Tags

#photoprism#photos#ai#face-recognition#gallery

Category

Media & Entertainment
Ad Space