Local LLM Deployment with Docker Compose: One Command, Full Private AI Stack
Most local LLM guides stop at a single chat window on one laptop. That is fine for testing, but a small team needs more: a shared model server, a web chat interface everyone can use, and an API that other tools can call. Docker Compose turns those three pieces into one file and one command — and when the machine reboots, the whole stack comes back by itself.
Why Compose Instead of Installing Everything by Hand
A local LLM setup has three moving parts that need to agree with each other. The inference engine runs the model. The chat interface talks to the engine. The API gateway lets scripts, editors, and other apps use the same models. Installed by hand, each part has its own version, its own port, and its own way of breaking after an update. Docker Compose pins all three in one file, so the setup you test on Monday is the setup still running on Friday.
The stack in this guide is deliberately boring: Ollama runs the models, Open WebUI gives the team a ChatGPT-style web interface, and LiteLLM exposes an OpenAI-compatible API so existing tools work without rewrites. All three are free and open source, and none of them sends your prompts to a cloud provider. If you only need the engine and nothing else, our practical local LLM deployment guide for small teams covers the minimal path first.
What you get when it is done
- A shared chat page at
http://your-server:3000— every teammate logs in and picks a model. - An API endpoint at
http://your-server:4000that speaks the OpenAI chat format, so tools built for cloud APIs keep working. - Models stored in one volume — download a model once, and the whole team uses it.
- Restart-proof —
restart: unless-stoppedbrings everything back after a reboot or a power cut.
What Hardware You Actually Need
Compose does not change the physics: a model still needs memory. What it changes is how little effort the setup takes. Pick the tier that matches the models you plan to run, not the tier you wish you had.
| Setup | Hardware | Good for |
|---|---|---|
| CPU only | 16 GB RAM, 4 cores, 50 GB disk | 7–8B models at a few tokens per second; fine for drafting and summaries |
| One consumer GPU | 24 GB VRAM (e.g. RTX 3090/4090), 32 GB RAM | 14–32B models at comfortable speed for a team of 5–10 |
| Small server GPU | 48 GB VRAM, 64 GB RAM | 70B-class quantized models, or several smaller models at once |
Start with the smallest model that does the job — usually a 7B or 8B instruct model — and only move up when the team hits a real quality wall. A bigger model that answers slowly helps nobody. Our model comparison for budget hardware maps popular models to the memory they need, so you can size the machine before you buy anything.
The Compose File
Create a folder for the project, save this as docker-compose.yml, and change only the two passwords. The ollama service runs the models, open-webui is the chat front end, and litellm is the API gateway. A named volume called ollama-data keeps downloaded models safe across restarts and upgrades.
Two notes before you run it. First, the GPU reservation block is optional — delete the whole deploy section if the machine has no NVIDIA GPU and Ollama will simply run on CPU. Second, the LiteLLM config file is tiny: it just lists the Ollama models you want to expose and the API key your tools will send.
Start It and Run the First Test
From the project folder, one command starts the whole stack. The first pull downloads a few gigabytes of images, so expect a couple of minutes; after that, restarts take seconds.
docker compose up -d— start all three services in the background.docker compose exec ollama ollama pull qwen3:8b— download your first model (about 5 GB).docker compose exec ollama ollama run qwen3:8b "Summarize this in one sentence: local models keep data on your own hardware."— confirm the engine answers.- Open
http://your-server:3000, create the admin account, and send your first chat message in Open WebUI. - Test the API:
curl http://your-server:4000/v1/models -H "Authorization: Bearer change-me-to-another-random-string"should listteam-chat.
If step 3 answers and step 4 shows the model in the web UI, the stack is working end to end. If the UI shows no models, check that Open WebUI can reach Ollama with docker compose logs open-webui — nine times out of ten it is a typo in the OLLAMA_BASE_URL or a container that has not finished starting yet.
Daily commands worth memorizing
- Update everything:
docker compose pull && docker compose up -d— pulls new images and restarts cleanly. - Add a model:
docker compose exec ollama ollama pull llama3.1:8b, then add it tolitellm-config.yamland restart LiteLLM. - See what is running:
docker compose psanddocker compose logs -f ollama. - Back up: copy the
ollama-dataandopen-webui-datavolumes (or just the whole project folder plusdocker volumeexport) before any major upgrade.
Making It Safe for a Real Team
A stack that only you use can be loose. A stack the whole team uses needs three rules, all cheap to add now and painful to add later.
- Never expose ports 11434, 3000, or 4000 to the internet. Keep the stack on your office network or behind a VPN, and put a reverse proxy with login in front of Open WebUI if anyone reaches it from outside. Our security hardening guide walks through the full checklist.
- Give LiteLLM real keys. The master key in the example is a placeholder. Generate a long random key per tool or per teammate, and rotate them when someone leaves. Anyone with the key can spend your GPU time.
- Pin your versions.
:latestis fine for a first test, but a team should pin image tags (for exampleollama/ollama:0.11) and upgrade on purpose, not by accident during a routine restart.
One more habit: keep a one-page note in the project folder with the model list, the admin login location, and the backup command. The person who fixes this stack at 9 pm on a Friday will not be you — or it will be you, and you will be glad the note exists.
Related reading
- Local LLM Deployment Guide for Small Teams — the minimal single-machine setup this stack builds on.
- Local LLM OpenAI-Compatible API Endpoints — how to point your existing tools at a local model.
- Local LLM Deployment Security Hardening 2026 — the lockdown checklist before you share the stack.
Limits and notes
Docker Compose is a deployment convenience, not a performance fix: it will not make a 7B model on a slow CPU fast, and it will not make a model smarter. GPU passthrough needs the NVIDIA Container Toolkit installed on the host, and Apple Silicon Macs run this stack through Docker Desktop with CPU inference only — for a Mac-first setup, see our Mac guide instead. Finally, treat model downloads as part of your disk budget: a handful of 8B models plus one 32B model easily passes 60 GB, so check disk space before pulling a new one.