Docker Volume Mounts¶
When using Docker, all application services run in isolated containers, so you must explicitly mount the host folders you want to use. Be aware that PhotoPrism and MariaDB cannot see folders that have not been mounted. This is an important security feature.
It is important that the originals, storage, and database folders are located on persistent volumes. We recommend changing the relative paths used in our examples to absolute paths and to avoid using named or anonymous Docker volumes to prevent potential data loss when the container is recreated, e.g. after an update of the Docker image.
Originals Folder¶
The originals folder contains your original photo and video files.
~/Pictures
will be mounted by default, where ~
is a shortcut for your home directory:
volumes:
# "/host/folder:/photoprism/folder" # example
- "~/Pictures:/photoprism/originals"
You can mount any folder accessible from the host, including network shares. Additional directories can also be mounted as sub folders of /photoprism/originals
(depending on overlay file system support):
volumes:
- "/home/username/Pictures:/photoprism/originals"
- "/example/friends:/photoprism/originals/friends"
- "/mnt/photos:/photoprism/originals/media"
On Windows, prefix the host path with the drive letter and use /
instead of \
as separator:
volumes:
- "D:/Example/Pictures:/photoprism/originals"
When read-only mode is enabled, all features that require write permission to the originals folder are disabled, e.g. WebDAV, uploading and deleting files. To do this, set PHOTOPRISM_READONLY
to "true"
in the environment
section of your compose.yaml
file. You can additionally mount volumes with the :ro
flag so that writes are also blocked by Docker.
Storage Folder¶
SQLite, config, cache, backup, thumbnail and sidecar files are saved in the storage folder:
- a storage folder mount must always be configured in your
compose.yaml
ordocker-compose.yml
file 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
- avoid using a named or anonymous Docker volume for permanently storing files, as this can lead to data loss when the container is recreated, e.g. after an update of the Docker image
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.
Import Folder¶
You can 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
- never configure the import folder to be inside the originals folder, as this will cause a loop by importing already indexed files
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.
MariaDB Database¶
Our example includes a pre-configured MariaDB database server that stores it files in the database
folder by default. If you remove it and provide no other database server credentials, SQLite database files will be created in the storage folder.
Please do not use a named or anonymous Docker volume for storing MariaDB database files and check the mount path of the volume if you use a custom database image (it may not always be /var/lib/mysql
), as both can lead to data loss when the database container is recreated, e.g. after an update of the Docker image.
Never store database files on an unreliable device such as a USB flash drive, SD card, or shared network folder. These may also have unexpected file size limitations, which is especially problematic for databases that do not split data into smaller files. We strongly recommend using SSD storage for databases only.
Network Storage¶
Shared folders that have already been mounted on your host under a drive letter or path can be used with Docker containers like any other directory. In addition, certain types of network storage like NFS (Unix/Linux) and CIFS (Windows/Mac) can also be mounted directly with Docker Compose.
For more information, see the Network Storage section of our Docker Troubleshooting Guide.