7 echo "Usage: ./docker_update.sh [OPTIONS]"
9 echo "Start all docker containers required to run Lemmy."
12 echo "-u Docker username. Only required if managing Docker via Docker Desktop with a personal access token."
13 echo "-h Print this help."
16 while getopts ":hu:" option; do
20 u) DOCKER_USER=$OPTARG
22 *) echo "Invalid option $OPTARG."
27 LOG_PREFIX="[🐀 lemmy]"
28 ARCH=$(uname -m 2>/dev/null || echo 'unknown') # uname may not exist on windows machines; default to unknown to be safe.
30 mkdir -p volumes/pictrs
32 echo "$LOG_PREFIX Please provide your password to change ownership of the pictrs volume."
33 sudo chown -R 991:991 volumes/pictrs
35 if [ "$ARCH" = 'arm64' ]; then
36 echo "$LOG_PREFIX WARN: If building from images, make sure to uncomment 'platform' in the docker-compose.yml file!"
38 # You need a Docker account to pull images. Otherwise, you will get an error like: "error getting credentials"
39 if [ -z "$DOCKER_USER" ]; then
40 echo "$LOG_PREFIX Logging into Docker Hub..."
43 echo "$LOG_PREFIX Logging into Docker Hub. Please provide your personal access token."
44 docker login --username="$DOCKER_USER"
47 echo "$LOG_PREFIX Initializing images in the background. Please be patient if compiling from source..."
48 docker compose up -d --build
50 sudo docker compose up -d --build
53 echo "$LOG_PREFIX Complete! You can now access the UI at http://localhost:1236."