Skip to content

Running PhotoPrism with Docker

We recommend using Docker Compose because it is easier and provides more convenience for running multiple services than the pure Docker command-line interface. Before you proceed, make sure you have Docker installed on your system. It is available for Mac, Linux, and Windows.

Step 1: Start the server

Open a terminal and run this command to start the app after replacing ~/Pictures with the folder containing your pictures:

docker run -d \
  --name photoprism \
  --security-opt seccomp=unconfined \
  --security-opt apparmor=unconfined \
  -p 2342:2342 \
  -e PHOTOPRISM_UPLOAD_NSFW="true" \
  -e PHOTOPRISM_ADMIN_PASSWORD="insecure" \
  -v /photoprism/storage \
  -v ~/Pictures:/photoprism/originals \
  photoprism/photoprism

The server port and other config options can be changed as needed. If you provide no database server credentials, SQLite database files will be created in the storage folder.

Always change PHOTOPRISM_ADMIN_PASSWORD so that the app starts with a secure initial password. Never use easy-to-guess passwords or default values like insecure on publicly accessible servers. There is no default in case no password was provided. A minimum length of 8 characters is required.

Commands on Linux may have to be prefixed with sudo when not running as root. Note that this will point the home directory shortcut ~ to /root in volume mounts. Kernel security modules such as AppArmor and SELinux have been reported to cause issues.

When the app has been started, open the Web UI by navigating to http://localhost:2342/. You should see a login screen. Sign in with the user admin and the password configured via PHOTOPRISM_ADMIN_PASSWORD. You may change it on the account settings page. Enabling public mode will disable authentication.

It can be helpful to keep Docker running in the foreground while debugging so that log messages are displayed directly. To do this, omit the -d parameter when restarting.

Should the server already be running, or you see no errors, you may have started it on a different host and/or port. There could also be an issue with your browser, ad blocker, or firewall settings.

It is not possible to change the password via PHOTOPRISM_ADMIN_PASSWORD after the app has been started for the first time. You may run docker exec -ti photoprism photoprism passwd in a terminal to change an existing password. You can also reset your database for a clean start.

Volumes

Since the app is running inside a container, you have to explicitly mount the host folders you want to use. PhotoPrism won't be able to see folders that have not been mounted. That's an important security feature.

/photoprism/originals

The originals folder contains your original photo and video files. They are mounted from ~/Pictures in the example above, where ~ is a shortcut for your home directory.

You may mount any folder accessible from the host instead, including network drives. Additional directories can be mounted as subfolders of /photoprism/originals:

-v ~/Example:/photoprism/originals/Example

If read-only mode is enabled, all features that require write permission to the originals folder are disabled, e.g. WebDAV, uploading and deleting files. Run the app with -e PHOTOPRISM_READONLY="true" for this. You can mount a folder with the :ro flag to make Docker block write operations as well.

/photoprism/storage

SQLite, cache, session, thumbnail and sidecar files are created in the storage folder:

  • a storage folder must always be mounted so that you do not lose these files after a restart or upgrade
  • never configure the storage folder to be inside the originals folder unless the name starts with a . to indicate that it is hidden
  • we recommend placing the storage folder on a local SSD drive for best performance
  • mounting symbolic links or using them inside the storage folder is currently not supported

Using our example, an anonymous volume is created and mounted as storage folder. You can mount a specific host folder instead, just as with originals, which is better for production environments.

Should you later want to move your instance to another host, the easiest and most time-saving way is to copy the entire storage folder along with your originals and database.

/photoprism/import

You may optionally mount an import folder from which files can be transferred to the originals folder in a structured way that avoids duplicates. Imported files receive a canonical filename and will be organized by year and month.

You can safely skip this. Adding files via Web Upload and WebDAV remains possible, unless read-only mode is enabled or the features have been disabled.

Step 2: First steps

Our First Steps 👣 tutorial guides you through the user interface and settings to ensure your library is indexed according to your individual preferences.

Easy, isn't it?

Step 3: When you're done...

You can stop PhotoPrism and start it again using the following commands:

docker stop photoprism
docker start photoprism

To remove the container completely:

docker rm -f photoprism

Back us on Patreon or GitHub Sponsors. Your continued support helps us provide regular updates and services like world maps. Thank you!

Troubleshooting

If your server runs out of memory, the index is frequently locked, or other system resources are running low:

Other issues? Our troubleshooting checklists help you quickly diagnose and solve them.

You are welcome to ask for help in our community chat. Sponsors receive direct technical support via email. Before submitting a support request, try to determine the cause of your problem.

Command-Line Interface

photoprism help lists all commands and config options available in the current version:

docker exec -ti photoprism photoprism help

Use the --help flag to see a detailed command description, for example:

docker exec -ti photoprism photoprism backup --help

When using Docker, you can prepend commands like docker exec -ti [container] [command] to run them in a container. Should this fail with no container found, make sure the container has been started and you have specified an existing container name or id.

PhotoPrism's command-line interface is well suited for job automation using a scheduler.

Examples

Action Command
Start PhotoPrism docker start photoprism
Stop PhotoPrism docker stop photoprism
Download Update docker pull photoprism/photoprism:latest
Uninstall docker rm -f photoprism
View Logs docker logs --tail=100 -f photoprism
Display Config Values docker exec -ti photoprism photoprism show config
Show Migration Status docker exec -ti photoprism photoprism migrations ls
Repeat Failed Migrations docker exec -ti photoprism photoprism migrations run -f
Reset Index Database docker exec -ti photoprism photoprism reset -y
Backup Index Database docker exec -ti photoprism photoprism backup -a -i
Restore Index Database docker exec -ti photoprism photoprism restore -a -i
Change Admin Password docker exec -ti photoprism photoprism passwd
Show User Management Commands docker exec -ti photoprism photoprism users help
Show Face Recognition Commands docker exec -ti photoprism photoprism faces help
Index Faces docker exec -ti photoprism photoprism faces index
Reset People & Faces docker exec -ti photoprism photoprism faces reset -f
Transcode Videos to AVC docker exec -ti photoprism photoprism convert
Regenerate Thumbnails docker exec -ti photoprism photoprism thumbs -f
Update Index docker exec -ti photoprism photoprism index --cleanup
Import Files docker exec -ti photoprism photoprism import [path]

Complete Rescan

docker exec -ti photoprism photoprism index -f rescans all originals, including already indexed and unchanged files. This may be necessary after major upgrades and after migrations of the database schema, especially if search results are missing or incorrect. Note You can also start a rescan from the user interface by navigating to Library > Index, checking "Full Rescan" and then clicking "Start".