Run PhotoPrism - A Google Photos Alternative - In Docker 🌱

What is PhotoPrism?

PhotoPrism® is an AI-Powered Photos App for the Decentralized Web. It makes use of the latest technologies to tag and find pictures automatically without getting in your way. You can run it at home, on a private server, or in the cloud. -https://github.com/photoprism/photoprism

Installing Docker

  1. Log into the Linux based device
  2. Run the following commands in the terminal
    # install prerequisites
    sudo apt install apt-transport-https ca-certificates git curl software-properties-common gnupg-agent -y
    # add docker gpg key
    curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
    # add docker software repository
    sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
    # install docker
    sudo apt install docker-ce docker-compose containerd.io -y
    # enable and start docker service
    sudo systemctl enable docker && sudo systemctl start docker
    # add the current user to the docker group
    sudo usermod -aG docker $USER
    # reauthenticate for the new group membership to take effect
    su - $USER

Running PhotoPrism

  1. Now that Docker is installed, run the following commands to setup the PhotoPrism Docker container and run it
    # create working directories
    mkdir ~/docker/photoprism/{storage,originals} -p && mkdir ~/docker/mariadb -p
    # set owner of working directories
    sudo chown "$USER":"$USER" ~/docker -R
    # create docker network
    docker network create containers
    # run the mariadb docker container
    docker run -d --name mariadb -e MYSQL_ROOT_PASSWORD=r00tp@$$ -e MYSQL_USER=photoprism_rw -e MYSQL_PASSWORD=Ph0t0Pr1sm -e MYSQL_DATABASE=photoprism -v ~/docker/mariadb:/var/lib/mysql --network containers --restart=unless-stopped mariadb:latest
    # run photoprism container
    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="SomethingSecure" -e PHOTOPRISM_DATABASE_DRIVER="mysql" -e PHOTOPRISM_DATABASE_SERVER="mariadb:3306" -e PHOTOPRISM_DATABASE_NAME="photoprism" -e PHOTOPRISM_DATABASE_USER="photoprism_rw" -e PHOTOPRISM_DATABASE_PASSWORD="Ph0t0Pr1sm" -v ~/docker/photoprism/storage:/photoprism/storage -v ~/docker/photoprism/originals:/photoprism/originals --network containers --restart=unless-stopped photoprism/photoprism
  2. Open a web browser and navigate to http://DNSorIP:2342
  3. Login with the username admin and the password set in the PHOTOPRISM_ADMIN_PASSWORD environment variable, SomethingSecure in this example
  4. Copy photos to the ~/docker/photoprism/originals directory or use the upload functionality in the web UI
  5. Welcome to PhotoPrism running in Docker

Source: https://docs.photoprism.app/getting-started/docker/