#!/bin/bash # Install / start AnythingLLM on Ubuntu via Docker (official image mintplexlabs/anythingllm). # Docs: https://docs.anythingllm.com/installation-docker/local-docker # UI: http://localhost:3001 # # Optional env: # STORAGE_LOCATION default: $HOME/anythingllm # HOST_PORT default: 3001 # Usage: ./install-anythingllm-docker.sh set -euo pipefail STORAGE_LOCATION="${STORAGE_LOCATION:-${HOME}/anythingllm}" HOST_PORT="${HOST_PORT:-3001}" IMAGE="${ANYTHINGLLM_IMAGE:-mintplexlabs/anythingllm}" CONTAINER_NAME="${ANYTHINGLLM_CONTAINER_NAME:-anythingllm}" mkdir -p "${STORAGE_LOCATION}" touch "${STORAGE_LOCATION}/.env" docker pull "${IMAGE}" if docker ps -a --format '{{.Names}}' | grep -qx "${CONTAINER_NAME}"; then docker rm -f "${CONTAINER_NAME}" fi docker run -d \ -p "${HOST_PORT}:3001" \ --name "${CONTAINER_NAME}" \ --cap-add SYS_ADMIN \ --add-host=host.docker.internal:host-gateway \ -v "${STORAGE_LOCATION}:/app/server/storage" \ -v "${STORAGE_LOCATION}/.env:/app/server/.env" \ -e STORAGE_DIR="/app/server/storage" \ "${IMAGE}" echo "AnythingLLM is starting. Open http://localhost:${HOST_PORT}" echo "Storage: ${STORAGE_LOCATION}"