Install PhotoPrism with Docker Compose
PhotoPrism runs as two Docker containers, the app and MariaDB, defined in one compose file. The part that needs planning is memory and disk: indexing and face recognition want at least 3~4 GB of RAM, so start with P4 or S8, and choose the plan by how many gigabytes of photos you will keep on its local NVMe.
Self-hosted apps guide, updated 2026-12-03
What do you install, and on which image?
PhotoPrism is not a one-click image on CheapVPS. The simplest base is the Docker CE image, which is Ubuntu 24.04 with Docker Engine and the Compose plugin already installed. On the plain Ubuntu 24.04 image, install Docker first as described in Docker Compose setup.
The stack has two services. photoprism is the web app and indexer; it reads your originals, creates thumbnails and runs the image classification and face models. mariadb stores the index, albums, labels and users. A reverse proxy in front adds HTTPS.
How much RAM and which plan does PhotoPrism need?
Browsing a finished library is light. The heavy moments are the first index and large uploads, when PhotoPrism decodes RAW files, builds several thumbnail sizes and runs its models in parallel workers. The project recommends at least 3 GB of RAM plus swap, and more memory for big RAW collections.
| Library | Plan | Specs |
|---|---|---|
| Personal library, JPEG and phone photos (Europe) | S8 | 4 vCPU, 8 GB RAM, 80 GB NVMe |
| Personal library, any of the 15 cities | P4 | 2 vCPU, 4 GB RAM, 80 GB NVMe |
| Family library with RAW files and video | P8 | 4 vCPU, 8 GB RAM, 160 GB NVMe |
| Arm option in Europe | A8 | 4 vCPU, 8 GB RAM, 80 GB NVMe |
Add 4 GB of swap in any case so a heavy index run slows down instead of being killed; see swap and memory. Pick the city nearest to where you upload and browse from; a family in the Netherlands fits Amsterdam, one in Japan fits Tokyo.
How much of the NVMe disk will photos use?
Each plan has a fixed local NVMe disk, and there is no add-on volume or block storage in the console, so the disk size is your library limit. Budget for three things:
- Originals: the photos and videos themselves, at their real size.
- Storage folder: thumbnails, sidecar files and cache. Expect roughly 10~25% of the originals size depending on settings.
- Database and system: a few GB for Ubuntu, Docker images and MariaDB.
Check usage with df -h / and du -sh /opt/photoprism/*. If your archive is larger than the disk, keep the full archive somewhere else and index a working set here, or mount remote storage as explained in adding storage with rclone or sshfs; remote mounts are slower to index, so local NVMe stays the best place for the storage folder and database.
How do you write the compose file?
Create a project folder and a compose file:
mkdir -p /opt/photoprism/{originals,storage,database,import}
cd /opt/photoprism
nano compose.yamlservices:
photoprism:
image: photoprism/photoprism:latest
restart: unless-stopped
depends_on:
- mariadb
ports:
- "127.0.0.1:2342:2342"
environment:
PHOTOPRISM_ADMIN_USER: "admin"
PHOTOPRISM_ADMIN_PASSWORD: "change-this-long-password"
PHOTOPRISM_SITE_URL: "https://photos.example.com/"
PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:3306"
PHOTOPRISM_DATABASE_NAME: "photoprism"
PHOTOPRISM_DATABASE_USER: "photoprism"
PHOTOPRISM_DATABASE_PASSWORD: "db-password-here"
PHOTOPRISM_WORKERS: "2"
volumes:
- "./originals:/photoprism/originals"
- "./storage:/photoprism/storage"
- "./import:/photoprism/import"
mariadb:
image: mariadb:11
restart: unless-stopped
command: --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MARIADB_DATABASE: "photoprism"
MARIADB_USER: "photoprism"
MARIADB_PASSWORD: "db-password-here"
MARIADB_ROOT_PASSWORD: "another-root-password"
volumes:
- "./database:/var/lib/mysql"The two database passwords must match. PHOTOPRISM_WORKERS limits parallel indexing; keep it at half your vCPU count on small plans so the web interface stays responsive during an index. Start the stack and watch the log:
docker compose up -d
docker compose logs -f photoprismThe project also publishes a full example file at its download site with every option commented; the one above is trimmed to the settings that matter here.
How do you put PhotoPrism behind HTTPS?
Point an A record for photos.example.com at 203.0.113.10, then let Caddy handle the certificate:
apt -y install caddy
cat > /etc/caddy/Caddyfile <<EOF
photos.example.com {
reverse_proxy 127.0.0.1:2342
request_body {
max_size 2GB
}
}
EOF
systemctl reload caddyThe raised body size lets large videos upload through the browser. With Nginx, set client_max_body_size in the same way and pass WebSocket headers, as in Nginx and HTTPS. The port mapping 127.0.0.1:2342 keeps PhotoPrism itself off the public internet; open only 22, 80 and 443 with ufw.
How do you set the admin password and add photos?
Log in at https://photos.example.com as admin with the password from the compose file. That variable is used when the account is first created; to change the password later, run:
docker compose exec photoprism photoprism passwd adminChoose a long password, since the login page is public. Then add photos in one of three ways:
- Copy them straight into
/opt/photoprism/originalswithrsync -av ~/Pictures/ root@203.0.113.10:/opt/photoprism/originals/, then start an index in Library, Index, or rundocker compose exec photoprism photoprism index. - Upload through the web interface.
- Use WebDAV from a phone or desktop app with the same login, which works over HTTPS.
The first full index of a large library can take hours; let it finish before judging speed.
Does PhotoPrism run on Arm plans?
Yes. The official images are multi-architecture, so docker compose pull fetches the arm64 build automatically on Arm plans, available in Frankfurt, Nuremberg, Helsinki and Amsterdam. A8 gives 4 vCPU, 8 GB RAM, 80 GB NVMe, a good fit for a mid-size family library. The compose file above works unchanged. Arm cores are real physical cores, so parallel thumbnail work scales well with PHOTOPRISM_WORKERS.
How do you update and back up PhotoPrism?
Update both containers together:
cd /opt/photoprism
docker compose pull
docker compose up -d
docker image prune -fA backup needs three parts: the originals, the database and the storage folder (which holds sidecar files and settings). Dump the database while it runs:
docker compose exec mariadb mariadb-dump -u root -p'another-root-password' photoprism | gzip > /root/photoprism-db-$(date +%F).sql.gzThen copy originals, storage and the dump to another server or storage with restic or rclone. The backup add-on ($2.41 per month on P4) keeps 7 daily copies of the whole disk as an extra layer; it is not a replacement for a copy of your originals somewhere else. See backups and restore.
What goes wrong most often?
- Indexing stops and the container restarts: out of memory. Check
journalctl -k | grep -i oom, lowerPHOTOPRISM_WORKERS, add swap, or use a bigger plan. - "Database connection failed" at start: MariaDB was not ready or the passwords differ. Run
docker compose logs mariadband compare both password variables. - Disk full: thumbnails grew faster than expected. Check
du -sh storage/cache, and consider a smaller thumbnail limit in settings. - Uploads fail at around 100 MB: the proxy body limit is too small; raise it as shown above.
- Wrong links in shared albums:
PHOTOPRISM_SITE_URLstill points at an IP or port. Fix it and recreate the container.
Questions about this guide
How many photos fit on one server?
It depends on file sizes, not the count. Add up your originals, add about a quarter for thumbnails, add a few GB for the system, and pick a plan whose NVMe disk holds that with room to grow.
Can I use SQLite instead of MariaDB?
PhotoPrism supports SQLite for small single-user tests, but MariaDB handles concurrent indexing and larger libraries much better, which is why this guide uses it.
Is video supported?
Yes, PhotoPrism indexes and plays common video formats and transcodes others with ffmpeg, which uses extra CPU during playback.
Can several family members use it?
Yes. Create further accounts in the settings. Review the user roles of your PhotoPrism edition before inviting people.
What traffic does browsing photos use?
Thumbnails are small, but downloading originals and streaming video count as outgoing traffic. A personal library rarely approaches the 20 TB that P4 includes in Europe.
Should I keep my only copy of photos here?
No single disk should hold your only copy. Keep originals on at least one other device or storage service as well.