PhotoPrism with Docker Compose
PhotoPrism® is an AI-powered, privacy-first app for browsing, organizing, and sharing photos and videos. It helps tag, search, and rediscover media without getting in your way, whether self-hosted or in the cloud. In the project's words: PhotoPrism README checked 2026-09-23
Runs on: amd64, arm64 from each image's registry manifest, checked 2026-09-25; a CPU counts only if every image has a build for it. Image by image
Add PhotoPrism to the builder to use your own domain, get its passwords generated in your browser, and combine it with other apps in one file.
What PhotoPrism needs
Only figures PhotoPrism's own documentation publishes, each linked to the page it is on. Where the project gives no number, this page does not invent one.
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | 3 GB | not stated |
| Physical memory, plus at least 4 GB of swap. Beyond the minimum, RAM should match the number of CPU cores. The docs advise against a hard memory limit, because the indexer temporarily needs more for large files, RAW images and panoramas. Source: PhotoPrism docs: Getting Started (System Requirements) checked 2026-09-23 | ||
| CPU | 2 cores | not stated |
| A 64-bit operating system is required. Source: PhotoPrism docs: Getting Started (System Requirements) checked 2026-09-23 | ||
| Disk | The project publishes no figure | |
| No size is published. Indexing large collections benefits greatly from local SSD storage, especially for the database and cache files. Source: PhotoPrism docs: Getting Started (System Requirements) checked 2026-09-23 | ||
Which hardware PhotoPrism has images for
Read from each image's manifest list in its registry (anonymous, read-only) when this page was built. An app counts for a CPU only if every one of its images lists it.
- x86-64 PC or NAS (
linux/amd64): every image has a build. - Raspberry Pi 4/5, 64-bit OS (
linux/arm64): every image has a build. - Raspberry Pi 3 or Zero 2 W, 32-bit OS (
linux/arm/v7): no image forphotoprism,mariadb. PhotoPrism's docs name separate 32-bit images for ARMv7 devices: photoprism/photoprism:armv7 for the app and yobasystems/alpine-mariadb:latest for MariaDB. Darktable is not included in the ARMv7 image, and the docs say to use the 64-bit image whenever the device can run it. The builder does not write these into the file. Source: PhotoPrism docs: Running PhotoPrism on a Raspberry Pi, Older ARMv7-based Devices checked 2026-09-25
| Service | Image | Platforms in the manifest | Digest | Registry | Checked |
|---|---|---|---|---|---|
photoprism | photoprism/photoprism:latest | amd64, arm64 | sha256:cea1af8ce28bd4c4da1ed40d57c86cbe9e58199bea1a6467eaaea10b1b32a925 | registry-1.docker.io | 2026-09-25 |
mariadb | mariadb:12.3 | amd64, arm64, ppc64le, s390x | sha256:805c8e104bd563d5bfa24fadd3f31cd419ea859cb5277f32b5dbf2db714f9ed1 | registry-1.docker.io | 2026-09-25 |
docker-compose.yml
This is exactly what the builder writes for PhotoPrism alone on example.org: the official definition with its published ports removed and Caddy added in front. Every ${VARIABLE} is defined in the .env below.
# docker-compose.yml built at dankhost.com for: PhotoPrism # Each app block is its official compose definition. Only the names were prefixed with # the app slug (services, containers, volumes, bind folders, .env variables) so any set of # apps can share one file; other differences are listed under "Changed:" in each block. # Only Caddy publishes ports. Secrets live in .env next to this file. services: # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ---- # Source: https://caddyserver.com/docs/running (checked 2026-09-23) # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23) # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly. caddy: image: "caddy:2" container_name: "caddy" restart: "unless-stopped" ports: - "80:80" - "443:443" - "443:443/udp" volumes: - "./caddy:/etc/caddy" - "caddy-data:/data" - "caddy-config:/config" networks: proxy: ipv4_address: "172.30.0.2" # ---- PhotoPrism (gallery.example.org) ---- # Source: https://docs.photoprism.app/getting-started/docker-compose/ (checked 2026-09-23) # Source: https://dl.photoprism.app/docker/compose.yaml (checked 2026-09-23) # Source: https://docs.photoprism.app/getting-started/proxies/caddy-2/ (checked 2026-09-23) # Changed: Removed the documented '2342:2342' port; Caddy reaches photoprism:2342 on the proxy network. # PHOTOPRISM_DISABLE_TLS is "true" and PHOTOPRISM_SITE_URL is your https address, as PhotoPrism's Caddy page says (Caddy terminates HTTPS); added PHOTOPRISM_TRUSTED_PROXY, set to Caddy's fixed address, from the same page. # The four documented 'insecure' passwords (admin, database user in both services, database root) are replaced by generated ones. # The documented originals folder ~/Pictures becomes ./photoprism/originals; point it at your photos by editing that line. # The optional ollama, open-webui and watchtower services, which the file only starts under compose profiles, are left out, and so are OLLAMA_BASE_URL and OLLAMA_API_KEY, which only point at them. Numeric values are written as strings, which Compose treats the same. photoprism: image: "photoprism/photoprism:latest" container_name: "photoprism" stop_grace_period: "15s" depends_on: - "photoprism-mariadb" security_opt: - "seccomp:unconfined" - "apparmor:unconfined" environment: PHOTOPRISM_ADMIN_USER: "admin" PHOTOPRISM_ADMIN_PASSWORD: "${PHOTOPRISM_ADMIN_PASSWORD}" PHOTOPRISM_AUTH_MODE: "password" PHOTOPRISM_DISABLE_TLS: "true" PHOTOPRISM_DEFAULT_TLS: "true" PHOTOPRISM_TRUSTED_PROXY: "172.30.0.2" PHOTOPRISM_DEFAULT_LOCALE: "en" PHOTOPRISM_PLACES_LOCALE: "local" PHOTOPRISM_SITE_URL: "https://gallery.example.org/" PHOTOPRISM_SITE_NAME: "" PHOTOPRISM_SITE_TITLE: "PhotoPrism" PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App" PHOTOPRISM_SITE_DESCRIPTION: "" PHOTOPRISM_SITE_AUTHOR: "" PHOTOPRISM_LOG_LEVEL: "info" PHOTOPRISM_READONLY: "false" PHOTOPRISM_EXPERIMENTAL: "false" PHOTOPRISM_DISABLE_CHOWN: "false" PHOTOPRISM_DISABLE_WEBDAV: "false" PHOTOPRISM_DISABLE_MCP: "false" PHOTOPRISM_DISABLE_SETTINGS: "false" PHOTOPRISM_DISABLE_TENSORFLOW: "false" PHOTOPRISM_DISABLE_FACES: "false" PHOTOPRISM_DISABLE_CLASSIFICATION: "false" PHOTOPRISM_DISABLE_VECTORS: "false" PHOTOPRISM_DISABLE_RAW: "false" PHOTOPRISM_RAW_PRESETS: "false" PHOTOPRISM_SIDECAR_YAML: "true" PHOTOPRISM_BACKUP_ALBUMS: "true" PHOTOPRISM_BACKUP_DATABASE: "true" PHOTOPRISM_BACKUP_SCHEDULE: "daily" PHOTOPRISM_INDEX_SCHEDULE: "" PHOTOPRISM_AUTO_INDEX: "300" PHOTOPRISM_AUTO_IMPORT: "-1" PHOTOPRISM_DETECT_NSFW: "false" PHOTOPRISM_UPLOAD_NSFW: "true" PHOTOPRISM_XMP_FACES: "true" PHOTOPRISM_UPLOAD_ALLOW: "" PHOTOPRISM_UPLOAD_ARCHIVES: "true" PHOTOPRISM_UPLOAD_LIMIT: "5000" PHOTOPRISM_ORIGINALS_LIMIT: "5000" PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_SERVER: "mariadb:3306" PHOTOPRISM_DATABASE_NAME: "photoprism" PHOTOPRISM_DATABASE_USER: "photoprism" PHOTOPRISM_DATABASE_PASSWORD: "${PHOTOPRISM_DB_PASSWORD}" PHOTOPRISM_INIT: "https tensorflow" PHOTOPRISM_VISION_API: "false" PHOTOPRISM_VISION_URI: "" PHOTOPRISM_VISION_KEY: "" working_dir: "/photoprism" volumes: - "./photoprism/originals:/photoprism/originals" - "./photoprism/storage:/photoprism/storage" networks: proxy: {} photoprism-backend: {} photoprism-mariadb: image: "mariadb:12.3" container_name: "photoprism-mariadb" restart: "unless-stopped" stop_grace_period: "15s" 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" volumes: - "./photoprism/database:/var/lib/mysql" environment: MARIADB_AUTO_UPGRADE: "1" MARIADB_INITDB_SKIP_TZINFO: "1" MARIADB_DATABASE: "photoprism" MARIADB_USER: "photoprism" MARIADB_PASSWORD: "${PHOTOPRISM_DB_PASSWORD}" MARIADB_ROOT_PASSWORD: "${PHOTOPRISM_DB_ROOT_PASSWORD}" networks: photoprism-backend: aliases: - "mariadb" networks: # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact. # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's # ipv4_address and in every trusted-proxy value to a free 172.x.0 range. proxy: ipam: config: - subnet: "172.30.0.0/24" ip_range: "172.30.0.128/25" gateway: "172.30.0.1" photoprism-backend: internal: true volumes: caddy-data: caddy-config:
Caddyfile save as caddy/Caddyfile
Caddy gets and renews the HTTPS certificate for gallery.example.org by itself once the DNS record points at your server and ports 80 and 443 reach it.
# Caddyfile built at dankhost.com. Save it as ./caddy/Caddyfile next to docker-compose.yml.
# Caddy gets and renews a Let's Encrypt certificate for each name below by itself,
# once the DNS records point at this server and ports 80 and 443 reach it.
# PhotoPrism
gallery.example.org {
encode zstd gzip
reverse_proxy photoprism:2342 {
flush_interval -1
}
}
.env
The secrets are left blank here on purpose: a password printed on a public page is the same for everyone who copies it. The builder fills them with random letters and digits made in your browser.
# .env for PhotoPrism, from dankhost.com/app/photoprism/. Fill the blank secrets before starting. # Keep this file private (chmod 600). # PhotoPrism # 24 random letters and digits: the builder fills this in your browser PHOTOPRISM_ADMIN_PASSWORD= # 32 random letters and digits: the builder fills this in your browser PHOTOPRISM_DB_PASSWORD= # 32 random letters and digits: the builder fills this in your browser PHOTOPRISM_DB_ROOT_PASSWORD=
Changes from the official file
Besides prefixing every service, container, volume, folder and variable with photoprism (so any set of apps can share one file), these are all the differences from what the project documents:
- Removed the documented '2342:2342' port; Caddy reaches photoprism:2342 on the proxy network.
- PHOTOPRISM_DISABLE_TLS is "true" and PHOTOPRISM_SITE_URL is your https address, as PhotoPrism's Caddy page says (Caddy terminates HTTPS); added PHOTOPRISM_TRUSTED_PROXY, set to Caddy's fixed address, from the same page.
- The four documented 'insecure' passwords (admin, database user in both services, database root) are replaced by generated ones.
- The documented originals folder ~/Pictures becomes ./photoprism/originals; point it at your photos by editing that line.
- The optional ollama, open-webui and watchtower services, which the file only starts under compose profiles, are left out, and so are OLLAMA_BASE_URL and OLLAMA_API_KEY, which only point at them. Numeric values are written as strings, which Compose treats the same.
Notes for PhotoPrism behind the proxy
- Log in as 'admin' with PHOTOPRISM_ADMIN_PASSWORD from .env. PhotoPrism uses it only on the first start; change it later in the app.
- The Caddyfile's 'encode zstd gzip' and 'flush_interval -1' (stream uploads) are from PhotoPrism's Caddy example.
- PhotoPrism has no restart policy in the documented file (MariaDB has one), so after a reboot run 'docker compose up -d' again or add restart: unless-stopped to the photoprism service.
- Indexing is heavy: the first scan of a large library can take hours and needs the RAM and swap in the requirements above.
How to run it
- At your DNS provider, add an A record named
galleryon your domain pointing at the server's public IP address, and forward TCP 80, TCP 443 and UDP 443 to it. - Save the three files in one folder:
docker-compose.ymland.envside by side, the Caddyfile at./caddy/Caddyfile. Replaceexample.orgwith your domain in the Caddyfile, the compose file and the .env, or let the builder do it. - Fill the blank
PHOTOPRISM_ADMIN_PASSWORD,PHOTOPRISM_DB_PASSWORD,PHOTOPRISM_DB_ROOT_PASSWORDin.env. The builder generates them; on the server,tr -dc A-Za-z0-9 </dev/urandom | head -c 32prints 32 random letters and digits. Thenchmod 600 .env. - Start it:
docker compose up -d docker compose logs -f caddy # watch the certificate arrive
- Open the new address (
gallery.plus your domain) in a browser and follow the notes above.
Back it up
PhotoPrism: a backup needs at least the originals folder and a copy of the index database; the storage folder too, so thumbnails, sidecar files and configuration need not be rebuilt. Its backup command dumps the MariaDB database into storage/backup/mysql/.
Below is the BACKUP.md the builder writes next to the compose file above: which of its folders and volumes hold data, the dump command the project documents, rewritten for this file's service names, what to copy with which container stopped, and a restore check. Pick more apps in the builder and it covers them all in one file.
# BACKUP.md built at dankhost.com for: PhotoPrism
What to copy from the docker-compose.yml built with this file, the database dump each project documents (rewritten for the service names in that file), what to copy with which container stopped, and how to check the result. Run every command in the folder that holds docker-compose.yml.
The folders are owned by the containers' users: put sudo in front of tar if it says "Permission denied". Named volumes live under /var/lib/docker/volumes, not next to the compose file, so they are copied through a throwaway ubuntu container (Docker's documented --volumes-from method). tar makes a full copy each run; for large folders an incremental tool (restic, borg, rsync) saves time and space.
Never run "docker compose down -v" on this file: it deletes the named volumes of every app in it.
## Before you start
BACKUP=/mnt/backup/selfhost # change this: a disk or machine other than this server's system disk
mkdir -p "$BACKUP"
## Every time: the three stack files
tar czf "$BACKUP/stack-files.tar.gz" docker-compose.yml .env caddy
.env holds the database passwords and secret keys the apps were set up with; keep this archive as private as the data.
## Caddy (the reverse proxy)
Caddy's docs: 'The data directory must not be treated as a cache.' It holds the TLS certificates and their private keys; without it Caddy has to ask Let's Encrypt for every certificate again.
- caddy-data (named volume, /data in caddy)
BACK UP: TLS certificates, private keys, OCSP staples.
- caddy-config (named volume, /config in caddy)
SKIP: the last active configuration, kept for 'caddy run --resume', which this setup does not use: it starts from the Caddyfile.
- ./caddy (/etc/caddy in caddy)
IN stack-files.tar.gz: the Caddyfile, copied with the stack files above.
Copy (Caddy keeps serving while you copy):
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu tar cvf /backup/caddy-data.tar /data
Restore check:
tar tf "$BACKUP/caddy-data.tar" > /dev/null && echo OK
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu bash -c "cd /data && tar xvf /backup/caddy-data.tar --strip 1"
Sources:
- Caddy docs: Conventions, Data directory: https://caddyserver.com/docs/conventions#data-directory (checked 2026-09-24)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-24)
## PhotoPrism
PhotoPrism: a backup needs at least the originals folder and a copy of the index database; the storage folder too, so thumbnails, sidecar files and configuration need not be rebuilt. Its backup command dumps the MariaDB database into storage/backup/mysql/.
What this compose mounts:
- ./photoprism/originals (/photoprism/originals in photoprism)
BACK UP: your photos and videos, unmodified.
- ./photoprism/storage (/photoprism/storage in photoprism)
BACK UP: configuration, cache, thumbnails, sidecar files and backup/ with the SQL dumps.
- ./photoprism/database (/var/lib/mysql in photoprism-mariadb)
COVERED BY THE COMMAND BELOW: MariaDB data files; copy them only with the database stopped.
1. Database dump for photoprism-mariadb (runs in photoprism):
docker compose exec -T photoprism photoprism backup -i -f
The documented Docker Compose command. It writes ./photoprism/storage/backup/mysql/<date>.sql (-f overwrites today's), which travels in the storage copy below. This compose also keeps PhotoPrism's daily scheduled dumps on (PHOTOPRISM_BACKUP_DATABASE), three kept by default.
2. Copy (PhotoPrism keeps running):
PhotoPrism says to run its backup command and then copy originals and storage with any file backup tool; it does not ask you to stop it.
tar czf "$BACKUP/photoprism-originals.tar.gz" ./photoprism/originals
tar czf "$BACKUP/photoprism-storage.tar.gz" ./photoprism/storage
Restore check:
ls -l ./photoprism/storage/backup/mysql/ # today's <date>.sql, not empty
tar tzf "$BACKUP/photoprism-originals.tar.gz" > /dev/null && echo OK
tar tzf "$BACKUP/photoprism-storage.tar.gz" > /dev/null && echo OK
Put a copy back (with PhotoPrism stopped):
tar xzf "$BACKUP/photoprism-originals.tar.gz" # recreates ./photoprism/originals; move the old folder aside first
tar xzf "$BACKUP/photoprism-storage.tar.gz" # recreates ./photoprism/storage; move the old folder aside first
Put ./photoprism/originals and ./photoprism/storage back first, then restore the index from the newest dump:
docker compose exec -T photoprism photoprism restore -i -f
Restoring also brings back the user accounts and passwords stored in the index.
Sources:
- PhotoPrism docs: Creating Backups: https://docs.photoprism.app/user-guide/backups/ (checked 2026-09-24)
- PhotoPrism docs: Restoring Backups: https://docs.photoprism.app/user-guide/backups/restore/ (checked 2026-09-24)
Update it
What docker compose pull does depends only on how each image line in the compose file above is tagged. For PhotoPrism as this page writes it:
| Service | Image | How it is pinned | What docker compose pull does |
|---|---|---|---|
caddy | caddy:2 | Major version only (tag 2) | Takes the newest image tagged 2: minor and patch releases of 2, never 3. A new major version needs a tag edit. |
photoprism | photoprism/photoprism:latest | Not pinned: moving tag latest | Moves to the newest image published as latest, which can be a new major version. |
photoprism-mariadb database | mariadb:12.3 | Major and minor version (tag 12.3) | Takes the newest image tagged 12.3: patch releases and rebuilds of 12.3 only. A newer minor or major version needs a tag edit. |
Do not raise the major version of photoprism-mariadb by editing its tag. Keep its tag, 12.3, as it is when you update PhotoPrism.
The MariaDB image's docs: on start it leaves an existing database untouched. Only when MARIADB_AUTO_UPGRADE is set does it run mariadb-upgrade to update the system tables for the new version, keeping a backup of them in the data folder, and MariaDB notes this can limit going back. Without it the system tables stay as they were; mariadb-upgrade is the tool that updates them. This file sets MARIADB_AUTO_UPGRADE on photoprism-mariadb. Source: MariaDB Docker Official Image: MARIADB_AUTO_UPGRADE checked 2026-09-30
What PhotoPrism's docs say about updating
PhotoPrism's update page: pull the new image and restart in the folder with the compose file. A new version may upgrade its index database when it starts, so back up first, above all before a major update.
- After a major update PhotoPrism recommends a complete rescan (Library > Index > Complete Rescan) and reading the release notes; a rescan keeps the labels, people, titles and captions you entered.
- It suggests comparing your compose file with its latest examples from time to time, for new settings.
- PhotoPrism's compose docs set MARIADB_AUTO_UPGRADE on the MariaDB service so that its tables are upgraded when MariaDB moves to a new major version; this file keeps it.
The steps
- Back up first, as in Back it up above. An update can migrate PhotoPrism's data on its first start and its database with it; the copy is the way back.
- Download the new images. Running containers are not touched yet:
docker compose pull
- Recreate the containers whose image changed. Volumes and bind-mounted folders stay as they are:
docker compose up -d
- Watch PhotoPrism start (Ctrl+C stops following the log, not the app):
docker compose logs -f photoprism
- Optional: remove the old images the pull left without a tag. This covers every stack on the machine, not only this one:
docker image prune
Locked out? Reset the admin password
Sets a new password for a PhotoPrism account. admin is the account this file creates (PHOTOPRISM_ADMIN_USER).
Run PhotoPrism's passwd command in the container. Source: PhotoPrism docs: Setup using Docker Compose, Command-Line Interface (Change Password) read 2026-10-03
docker compose exec photoprism photoprism passwd admin
Sources
Every page below was fetched on the date shown.
- PhotoPrism README checked 2026-09-23 (what it does)
- PhotoPrism docs: Getting Started (System Requirements) checked 2026-09-23 (hardware requirements)
- PhotoPrism docs: Setup Using Docker Compose checked 2026-09-23 (compose definition and proxy settings, update notes)
- PhotoPrism: compose.yaml (the file the setup guide downloads) checked 2026-09-23 (compose definition and proxy settings)
- PhotoPrism docs: Using Caddy 2 as Reverse Proxy (DISABLE_TLS, TRUSTED_PROXY, Caddyfile) checked 2026-09-23 (compose definition and proxy settings)
- Caddy docs: Keep Caddy running (Docker Compose section) checked 2026-09-23 (Caddy)
- Vaultwarden wiki: Caddy with HTTP challenge (uses the caddy:2 image) checked 2026-09-23 (Caddy)
- PhotoPrism docs: Creating Backups checked 2026-09-24 (backup plan)
- PhotoPrism docs: Restoring Backups checked 2026-09-24 (backup plan)
- Caddy docs: Conventions, Data directory checked 2026-09-24 (backup plan)
- Docker docs: Volumes, Back up, restore, or migrate data volumes checked 2026-09-24 (backup plan)
- PhotoPrism docs: Getting Updates checked 2026-09-30 (update notes)
- MariaDB Docker Official Image: MARIADB_AUTO_UPGRADE checked 2026-09-30 (database upgrade)
- Docker docs: docker compose pull checked 2026-09-30 (update steps)
- Docker docs: docker compose up (recreates changed containers, keeps volumes) checked 2026-09-30 (update steps)
- Docker docs: docker image prune checked 2026-09-30 (update steps)