litellm/docker/docker-compose.quickstart.yml
kerry 5f2c468fc3 fix(quickstart): ignore a shell POSTGRES_PASSWORD, URL-encode the database password, and accept LITELLM_BIND as a plain IP
Pass database credentials separately so LiteLLM can encode reserved characters and Compose ignores a shell POSTGRES_PASSWORD. Migrate existing .env files to the namespaced password key and plain-IP bind format

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-03 03:58:29 +00:00

45 lines
1.7 KiB
YAML

# LiteLLM quickstart stack: the gateway plus a Postgres database that stores
# models, virtual keys, and spend logs. Used by
# https://docs.litellm.ai/docs/proxy/docker_quick_start
#
# curl -sSLO https://github.com/BerriAI/litellm/raw/main/docker/docker-compose.quickstart.yml
# printf 'LITELLM_MASTER_KEY=sk-%s\nLITELLM_SALT_KEY=sk-%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
# docker compose -f docker-compose.quickstart.yml up -d
#
# Compose reads .env from this directory. Keep it: regenerating LITELLM_SALT_KEY
# makes credentials already stored in the database unreadable. For anything
# beyond local evaluation, pin the image to a specific release tag.
services:
litellm:
image: docker.litellm.ai/berriai/litellm:main-stable
ports:
# LITELLM_BIND is a plain IP, such as 127.0.0.1 for local-only access.
- "${LITELLM_BIND:+${LITELLM_BIND}:}${LITELLM_PORT:-4000}:4000"
environment:
LITELLM_MASTER_KEY: ${LITELLM_MASTER_KEY:?set it in .env - see the header of this file}
LITELLM_SALT_KEY: ${LITELLM_SALT_KEY:?set it in .env - see the header of this file}
DATABASE_HOST: db:5432
DATABASE_USERNAME: litellm
DATABASE_PASSWORD: ${LITELLM_POSTGRES_PASSWORD:-litellm}
DATABASE_NAME: litellm
STORE_MODEL_IN_DB: "True"
depends_on:
db:
condition: service_healthy
db:
image: postgres:16
environment:
POSTGRES_USER: litellm
POSTGRES_PASSWORD: ${LITELLM_POSTGRES_PASSWORD:-litellm}
POSTGRES_DB: litellm
healthcheck:
test: ["CMD-SHELL", "pg_isready -U litellm"]
interval: 5s
timeout: 5s
retries: 10
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data: