Install PhotoPrism Inside Docker Container in Linux

Install PhotoPrism Inside Docker Container in Linux

PhotoPrism is a web-based photo management tool for uploading, managing and sharing photos. PhotoPrism provides automatic image classification, searching images using various filters, RAW file format conversion, duplicate files detection, and more.

This tutorial explains how to install PhotoPrism inside a Docker container in the Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

You also need to have a running MariaDB container. Instructions can be found in the post.

Install PhotoPrism

Before starting, create photoprism database:

docker exec -it mariadb mariadb -u root -p -e "CREATE DATABASE photoprism"
  • Host network

Run the following command to create a container for PhotoPrism that uses host network:

docker run -d --name=photoprism --restart=always --network=host \
    -v /opt/photoprism/photos:/photoprism/originals \
    -v /opt/photoprism/data:/photoprism/storage \
    -e PHOTOPRISM_ADMIN_USER=admin \
    -e PHOTOPRISM_ADMIN_PASSWORD=pwd123 \
    -e PHOTOPRISM_DATABASE_DRIVER=mysql \
    -e PHOTOPRISM_DATABASE_USER=root \
    -e PHOTOPRISM_DATABASE_PASSWORD=pwd123 \
    -e PHOTOPRISM_DATABASE_NAME=photoprism \
    -e PHOTOPRISM_DATABASE_SERVER=127.0.0.1:3306 \
    photoprism/photoprism

MariaDB container should run on host network as well.

  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, PhotoPrism service is listening on port 2342. It can be changed with -p option.

docker network create app-net
docker run -d --name=photoprism --restart=always --network=app-net \
    -p 8080:2342 \
    -v /opt/photoprism/photos:/photoprism/originals \
    -v /opt/photoprism/data:/photoprism/storage \
    -e PHOTOPRISM_ADMIN_USER=admin \
    -e PHOTOPRISM_ADMIN_PASSWORD=pwd123 \
    -e PHOTOPRISM_DATABASE_DRIVER=mysql \
    -e PHOTOPRISM_DATABASE_USER=root \
    -e PHOTOPRISM_DATABASE_PASSWORD=pwd123 \
    -e PHOTOPRISM_DATABASE_NAME=photoprism \
    -e PHOTOPRISM_DATABASE_SERVER=mariadb:3306 \
    photoprism/photoprism

MariaDB container should run on the same user-defined bridge network as well.

Notes:

  • Don't forget to change admin password for PhotoPrism using PHOTOPRISM_ADMIN_PASSWORD.
  • The PHOTOPRISM_DATABASE_USER and PHOTOPRISM_DATABASE_PASSWORD can be used to specify MariaDB credentials.
  • When user-defined bridge network is used, don't forget to change PHOTOPRISM_DATABASE_SERVER. It specifies MariaDB container name.

Testing PhotoPrism

Open a web browser and go to http://<IP_ADDRESS>:2342, where <IP_ADDRESS> is the IP address of the system. Log in to the dashboard with the admin username and password.

PhotoPrism Inside Docker Container in Linux

Uninstall PhotoPrism

To completely remove PhotoPrism, remove its container:

docker rm --force photoprism

Remove PhotoPrism image:

docker rmi photoprism/photoprism

You can also remove PhotoPrism data:

sudo rm -rf /opt/photoprism

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.