Running AI models on your own hardware keeps source code, client files, and API budgets under your control. Using Ollama with Open WebUI inside Docker gives your team a private ChatGPT-style workspace in under five minutes.
In this guide, we set up both containers with one Compose file, pull a model, and connect local tools to the API. For teams wiring local models into document retrieval, check our production RAG systems guide.
Executive Summary
- One-file stack: Ollama runs the model weights on port
11434while Open WebUI serves the chat interface on host port3000. - Zero cloud leaks: Prompts, chat history, and uploaded files stay inside local Docker volumes.
- OpenAI-compatible endpoint: Point coding agents or scripts to
http://localhost:11434/v1with no per-token bill. - Hardware rule of thumb: An 8 GB GPU runs 7B to 8B quantized models comfortably, while 16 GB+ handles 14B to 32B models.
Table of Contents
- 1. Prerequisites and Hardware Sizing
- 2. Create the Docker Compose Stack
- 3. Pull Your First Model and Open the UI
- 4. Connect Local Tools to the Ollama API
- 5. Ports, Volumes, and GPU Reference
- 6. Frequently Asked Questions
1. Prerequisites and Hardware Sizing
You need Docker Engine and Docker Compose installed on Linux, macOS, or Windows WSL2. An NVIDIA or AMD GPU speeds up token generation, though Apple Silicon and modern CPUs also work.
Pick a model size that fits your available memory. A 7B or 8B parameter model at 4-bit quantization (Q4_K_M) needs roughly 5 GB to 6 GB of VRAM or unified RAM. If the model spills into system swap, generation slows down sharply.
Pro Tip: Check your token budget and context window limits before loading huge files into a local model. Our token limit and truncation guide explains how context length affects speed and memory.
2. Create the Docker Compose Stack
Create a new folder and save the following docker-compose.yml file inside it. This links both services on an internal Docker network so Open WebUI talks to Ollama by service name.
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- "11434:11434"
volumes:
- ollama:/root/.ollama
restart: unless-stopped
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
ports:
- "3000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
volumes:
- open-webui:/app/backend/data
depends_on:
- ollama
restart: unless-stopped
volumes:
ollama:
open-webui:
If you are running on Linux with an NVIDIA GPU, add a deploy.resources.reservations.devices block under the ollama service with driver: nvidia and capabilities: [gpu]. Without GPU passthrough, Docker runs inference on your CPU.
3. Pull Your First Model and Open the UI
Start both containers in the background, then pull a compact model such as Llama 3.1 or Qwen 2.5 Coder inside the running Ollama container.
docker compose up -d
docker compose exec ollama ollama pull llama3.1:8b
Next, open http://localhost:3000 in your browser and create your local admin account. Because Open WebUI stores accounts inside its own volume, that signup stays completely offline.
Select your pulled model from the top dropdown menu and send a test prompt. You can also upload PDFs or markdown files directly in the chat bar for local document Q&A.
4. Connect Local Tools to the Ollama API
Ollama exposes an OpenAI-compatible REST endpoint on port 11434. Any editor plugin, Python script, or automation tool that accepts a custom base URL can use your local model.
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "llama3.1:8b",
"messages": [{"role": "user", "content": "Write a 3-line Python health check."}]
}'
If you want to wire local models into enterprise developer tools, read our production MCP architecture guide for safe tool-calling patterns.
5. Ports, Volumes, and GPU Reference
| Component | Host Port | Volume Path | Purpose |
|---|---|---|---|
| Ollama API | 11434 | /root/.ollama | Stores GGUF weights and serves local REST API |
| Open WebUI | 3000 (maps to 8080) | /app/backend/data | Serves chat UI, user accounts, and local RAG index |
6. Frequently Asked Questions
Does Open WebUI send data to OpenAI or external servers?
No. When connected only to your local Ollama container, all prompts, embeddings, and chat logs remain in your local Docker volumes.
How do I update Ollama and Open WebUI without losing models?
Run docker compose pull followed by docker compose up -d. Your downloaded models and chats stay safe inside the named Docker volumes.
Can I run this stack on a shared team server?
Yes. Put a reverse proxy with HTTPS (such as Caddy or Nginx) in front of port 3000 and disable open registration in Open WebUI admin settings after creating team accounts.
We hope this guide helped you launch a private local LLM workspace. Next, check our comparison of vector databases for RAG or explore zero-bloat developer tools.




[…] coding agents, voice assistants, and enterprise workspace tools. Many organizations now run local open-weight LLMs with Ollama and Docker alongside cloud APIs to control cost and data […]