* feat(docker): manage a quickstart install with status, stop, start, and uninstall Rerunning either quickstart now opens a menu for the existing install instead of installing again, and both scripts take an action: status, start (up), stop (down), restart, logs, open, update, uninstall Each install gets a litellm-gateway command (litellm-gateway.cmd on Windows) in its folder, linked into ~/.local/bin when that is on PATH, so stopping and starting no longer means finding the containers by hand - stop keeps the database; uninstall asks before deleting it, keeps the images unless asked, and checks for leftovers - a busy port names the process holding it - -y / -Yes answers every question for scripts and CI * chore(docker): run the quickstart on the latest image instead of main-stable The docs mark main-stable as deprecated, and on the registry both tags point at the same image digest today. The quickstart is for local evaluation, and the file already says to pin a release tag for anything beyond that * fix(docker): trust a container's compose project label only when it is a valid project name When another container holds the port, the quickstart offers to stop it with docker compose -p <project> stop, taking the project from the container's label. Whoever started the container sets that label, and quickstart.sh split it into words, so a crafted label could add arguments to the stop command - a label Compose would not accept as a project name now counts as no project, and the container is stopped by name instead - quickstart.sh runs the stop with quoted arguments rather than splitting a command string * feat(docker): show how many requests the quickstart gateway has handled The status box, shown by litellm-gateway status and by the rerun menu, gains a Requests row, so a quick test shows the gateway is working - the count comes from /global/activity with the admin key from .env, failed requests included; curl reads the key from stdin, off the command line - the row is left out when the gateway cannot say, such as an older image - help is now listed in the usage text; help, -h, and --help already printed it * fix(docker): move to a free port instead of stopping an unrelated container When an install's saved port is taken, the quickstart now only offers to stop the holder if it is another quickstart install. For anything else it offers the next free port and saves it in .env, so it never stops someone else's app. A port set through LITELLM_PORT is never moved. |
||
|---|---|---|
| .. | ||
| build_from_pip | ||
| tests | ||
| .env.example | ||
| build_admin_ui.sh | ||
| component_entrypoint.sh | ||
| docker-compose.quickstart.yml | ||
| docker-compose.tracing.yml | ||
| Dockerfile.database | ||
| Dockerfile.non_root | ||
| entrypoint.sh | ||
| install_auto_router.sh | ||
| prod_entrypoint.sh | ||
| README.md | ||
| tracing-config.yaml | ||
Docker Development Guide
This guide provides instructions for building and running the LiteLLM application using Docker and Docker Compose.
Just want to run LiteLLM? This guide builds from source. To run the published image instead, use
docker-compose.quickstart.ymlin this directory — the two-service stack (gateway + Postgres) that the Docker quickstart documents: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
Prerequisites
- Docker
- Docker Compose
Building and Running the Application
To build and run the application, you will use the docker-compose.yml file located in the root of the project. This file is configured to use the Dockerfile.non_root for a secure, non-root container environment.
1. Set the Master Key
The application requires a LITELLM_MASTER_KEY for signing and validating tokens. You must set this key as an environment variable before running the application.
Create a .env file in the root of the project and add the following line:
LITELLM_MASTER_KEY=your-secret-key
Replace your-secret-key with a strong, randomly generated secret.
2. Build and Run the Containers
Once you have set the LITELLM_MASTER_KEY, you can build and run the containers using the following command:
docker compose up -d --build
This command will:
- Build the Docker image using
Dockerfile.non_root. - Start the
litellm,litellm_db, andprometheusservices in detached mode (-d). - The
--buildflag ensures that the image is rebuilt if there are any changes to the Dockerfile or the application code.
3. Verifying the Application is Running
You can check the status of the running containers with the following command:
docker compose ps
To view the logs of the litellm container, run:
docker compose logs -f litellm
4. Stopping the Application
To stop the running containers, use the following command:
docker compose down
Embedded LiteAdmin MCP
Source builds containing embedded LiteAdmin MCP can serve it at /admin/mcp on the existing LiteLLM port. This capability is unreleased. Keep your existing database, master key, and proxy configuration, then add these settings to the serving container's environment:
LITELLM_ENABLE_ADMIN_MCP=true
LITELLM_LICENSE="your-enterprise-license"
PROXY_BASE_URL=https://gateway.example.com
For the unified source deployment described above, put them in its .env file and rebuild:
docker compose up -d --build
In componentized deployments, set the flag and license on the backend container and route /admin/mcp to the backend service. The gateway component excludes this endpoint. The unified, database, non-root, and backend image builds bundle the connector
Hosting is disabled by default. Opting in requires a valid base Enterprise license; an unlicensed opt-in or invalid flag value prevents startup. Enabling it reserves /admin, so rename any MCP server alias called admin first
With native key authentication, connect with a personal proxy-admin bearer key. When enable_oauth2_proxy_auth is enabled, the existing trusted-proxy identity headers select the user instead; the MCP bearer is required by the connector but does not select the native user. The resolved user must have the stored proxy_admin role, and trusted_proxy_ranges applies to the original caller's direct peer
Embedded responses default to full; selecting LITELLM_ADMIN_RESPONSE_VIEW=compact requires subsequent saved-result reads to reach the same worker process, including within a multi-worker pod
See the LiteAdmin MCP guide for client configuration, tool restrictions, and verification
Hardened / Offline Testing
To ensure changes are safe for non-root, read-only root filesystems and restricted egress, always validate with the hardened compose file:
docker compose -f docker-compose.yml -f docker-compose.hardened.yml build --no-cache
docker compose -f docker-compose.yml -f docker-compose.hardened.yml up -d
This setup:
- Builds from
docker/Dockerfile.non_rootwith Prisma engines and Node toolchain baked into the image. - Runs the proxy as a non-root user with a read-only rootfs and only writable tmpfs mounts:
/app/cache(Prisma/NPM cache; backingPRISMA_BINARY_CACHE_DIR,NPM_CONFIG_CACHE,XDG_CACHE_HOME)/app/migrations(Prisma migration workspace; backingLITELLM_MIGRATION_DIR)
- Pre-builds and serves the admin UI from read-only paths:
/var/lib/litellm/ui(pre-restructured Next.js UI with.litellm_ui_readymarker)/var/lib/litellm/assets(UI logos and assets)
- Routes all outbound traffic through a local Squid proxy that denies egress, so Prisma migrations must use the cached CLI and engines.
You should also verify offline Prisma behaviour with:
docker run --rm --network none --entrypoint prisma ghcr.io/berriai/litellm:main-stable --version
This command should succeed (showing engine versions) even with --network none, confirming that Prisma binaries are available without network access.
Troubleshooting
build_admin_ui.sh: not found: This error can occur if the Docker build context is not set correctly. Ensure that you are running thedocker-composecommand from the root of the project.Master key is not initialized: This error means theLITELLM_MASTER_KEYenvironment variable is not set. Make sure you have created a.envfile in the project root with theLITELLM_MASTER_KEYdefined.