Blazing Fast Photo Hosting on a Raspberry Pi

While there are dozens of self-hosted photo gallery server projects available for the Raspberry Pi, PiGallery2 was designed for speed, low resource usage, and ease-of-use. Plus it was specifically built with the Raspberry Pi in mind. Here’s how to install and use it.
What Is PiGallery2?
PiGallery2 is a directory-first photo gallery website, optimized for running on low-end servers with limited resources—such as the original Raspberry Pi. It’s developer, Bpatrik, describes it as “fast (like faster than your PC fast)” and “Fast, like for real”.
PiGallery2 is also simple to use. Once set up, you can just point at the directory where your photos are kept, and PiGallery2 will do the rest.
How to Install PiGallery2 on Your Raspberry Pi
You’ll be pleased to learn that PiGallery2 is absurdly easy to set up and use.
After setting up your Raspberry Pi to act as a server, log in via SSH (secure shell), then update and upgrade any installed packages:
sudo apt update
sudo apt upgrade
You now need to create a new directory for PiGallery2, plus subdirectories for config, images, and temporary files:
mkdir pigallery2
mkdir pigallery2/images
mkdir pigallery2/config
mkdir pigallery2/tmp
Use nano to create a new file in your home directory:
nano docker-compose.yml
Then paste in:
version: '3'
services:
pigallery2:
image: bpatrik/pigallery2:latest
container_name: pigallery2
environment:
- NODE_ENV=production
volumes:
- "./pigallery2/config:/app/data/config" # CHANGE ME
- "db-data:/app/data/db"
- "./pigallery2/images:/app/data/images:ro" # CHANGE ME, ':ro' mean read-only
- "./pigallery2/tmp:/app/data/tmp" # CHANGE ME
ports:
- 80:80
restart: always
volumes:
db-data:
Save and exit nano with Ctrl + O then Ctrl +X
Tell Docker to pull the containers onto your system:
docker-compose pull
And start them with:
docker-compose up -d
PiGallery2 is now up and running!
Using PiGallery2 on Your Raspberry Pi
PiGallery2 creates galleries which can be viewed over the internet, based on images in the /home/pi/pigallery2/images directory. This is currently empty, so use secure copy to transfer image files and folders from your local machine:
scp -r /path/to/local/images
Open a browser and navigate to your.local.pi.ip:80, and you will be prompted to log in. The default username is “admin”, and the password is “admin”.
The screen will populate with images from the “images” directory on your Pi, and you’ll be able to see that the developers were telling the truth—PiGallery2 is blindingly fast. As fast, in fact as viewing photos in an app on your local machine. There isn’t a whole lot to PiGallery2 than that.
The Simplest Way to Serve Photos From a Raspberry Pi
PiGallery2 does one thing and does it exceptionally well. It serves photos fast—although it does not cope well with libraries of over 100,000 images, or individual albums of over 5,000 pictures. If you want more features from your Raspberry Pi photo management software, consider a more fully featured app such as PhotoPrism or a commercial hosting solution.
Read the full article here