docker.recipes

PiGallery2

beginner

Fast directory-first photo gallery.

Overview

PiGallery2 is a modern, lightweight photo gallery application designed with a directory-first approach that reads photos directly from your filesystem without requiring uploads or imports. Created by Patrik Braun, this Node.js-based gallery application automatically generates thumbnails, supports face detection, includes GPS mapping capabilities, and handles video playback while maintaining an extremely small resource footprint that makes it ideal for single-board computers like Raspberry Pi. The application stands out from traditional photo galleries by eliminating the need for database-heavy solutions or complex media management workflows. This Docker deployment leverages the official PiGallery2 image to create a self-contained photo gallery that mounts your existing photo directories as read-only volumes. The containerized setup includes dedicated volumes for configuration storage, database files, and temporary processing files, while exposing the web interface on port 8080. PiGallery2's efficient architecture means it can handle large photo collections without pre-processing requirements, generating thumbnails and metadata on-demand as users browse. This stack is perfect for photographers, families, and organizations who want a fast, no-nonsense photo gallery that respects existing folder structures and doesn't lock photos into proprietary formats. Home lab enthusiasts particularly appreciate PiGallery2's minimal resource requirements and ability to run efficiently on ARM-based devices, while still providing advanced features like facial recognition, GPS-based photo mapping, and support for RAW image formats alongside standard photo and video files.

Key Features

  • Directory-first photo browsing that preserves your existing folder organization
  • Real-time thumbnail generation with multiple size options and quality settings
  • Built-in face detection and recognition for automatic photo tagging
  • Interactive GPS map integration showing photo locations with clustering
  • Support for RAW image formats including CR2, NEF, ARW, and DNG files
  • Video playback support with thumbnail generation for MP4, AVI, and MOV files
  • Advanced search functionality including EXIF data, keywords, and date ranges
  • Responsive web interface optimized for mobile devices and tablets

Common Use Cases

  • 1Personal photo galleries for families wanting to share memories across devices
  • 2Photography studios showcasing client work organized by shoot or event
  • 3Travel bloggers displaying geotagged photos with interactive map views
  • 4Home media servers running on Raspberry Pi or other low-power devices
  • 5Small businesses organizing product photography and marketing materials
  • 6Event photographers providing client access to organized photo collections
  • 7Archive digitization projects requiring lightweight browsing of large collections

Prerequisites

  • Docker and Docker Compose installed on your system
  • Minimum 512MB RAM available for the container and thumbnail generation
  • Read access to photo directories you want to display in the gallery
  • Port 8080 available on your host system for web interface access
  • Sufficient disk space for thumbnail cache and temporary file processing
  • Basic understanding of Docker volume mounting for photo directory 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 pigallery2:
3 image: bpatrik/pigallery2:latest
4 container_name: pigallery2
5 restart: unless-stopped
6 ports:
7 - "8080:80"
8 environment:
9 NODE_ENV: production
10 volumes:
11 - pigallery_config:/app/data/config
12 - pigallery_db:/app/data/db
13 - pigallery_tmp:/app/data/tmp
14 - /path/to/photos:/app/data/images:ro
15
16volumes:
17 pigallery_config:
18 pigallery_db:
19 pigallery_tmp:

.env Template

.env
1# Configure your photos path

Usage Notes

  1. 1Docs: https://bpatrik.github.io/pigallery2/
  2. 2Access at http://localhost:8080 - no auth by default
  3. 3Reads directly from filesystem - no import/upload required
  4. 4Auto-generates thumbnails on first view
  5. 5Very lightweight - great for Raspberry Pi
  6. 6Face detection, GPS map view, and video support included

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 pigallery2:
5 image: bpatrik/pigallery2:latest
6 container_name: pigallery2
7 restart: unless-stopped
8 ports:
9 - "8080:80"
10 environment:
11 NODE_ENV: production
12 volumes:
13 - pigallery_config:/app/data/config
14 - pigallery_db:/app/data/db
15 - pigallery_tmp:/app/data/tmp
16 - /path/to/photos:/app/data/images:ro
17
18volumes:
19 pigallery_config:
20 pigallery_db:
21 pigallery_tmp:
22EOF
23
24# 2. Create the .env file
25cat > .env << 'EOF'
26# Configure your photos path
27EOF
28
29# 3. Start the services
30docker compose up -d
31
32# 4. View logs
33docker 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/pigallery2/run | bash

Troubleshooting

  • Photos not appearing in gallery: Verify the photo directory path is correctly mounted and the container has read permissions to the mounted volume
  • Thumbnails not generating or appearing broken: Check that the pigallery_tmp volume has sufficient space and the container can write to temporary directories
  • High memory usage during thumbnail generation: Reduce concurrent thumbnail generation in PiGallery2 settings or increase container memory limits for large image processing
  • Face detection not working: Ensure the container has adequate CPU resources and check that face detection is enabled in the gallery configuration settings
  • GPS map not displaying photo locations: Verify photos contain GPS EXIF data and check browser console for JavaScript errors related to map loading
  • Container failing to start with database errors: Clear the pigallery_db volume and restart to reset the SQLite database, then allow PiGallery2 to reinitialize

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