Your first local LLM in 15 minutes with Ollama and Open WebUI in Docker
Run your own private ChatGPT-style assistant on a home server. NVIDIA drivers, Docker Compose, Ollama as the backend and Open WebUI as a friendly browser interface.
updated 4 minutes read Czytaj po polsku

On this page (9)
Key takeaways
- Two containers: Ollama loads the model onto the GPU, Open WebUI gives you a chat interface in the browser.
- GPUs in Docker need the NVIDIA driver and the NVIDIA Container Toolkit.
- Never expose port 11434 to the network, the Ollama API has no authentication.
- The ollama ps command tells you whether the model fits entirely in VRAM.
A local language model is now a matter of a single compose.yaml file. In this guide we run two containers: Ollama, which loads the model onto your graphics card and exposes an API, and Open WebUI, a chat interface similar to the ones you know from commercial services. Everything runs inside your network and nothing leaves it.
What you need
- Linux with Docker (Debian, Ubuntu, Fedora, a Proxmox VM, anything).
- An NVIDIA card with at least 8 GB of VRAM. It works without a GPU too, but an 8B model will then generate only a few tokens per second.
- About 20 GB of free disk space for the images and your first models.
Step 1: drivers and the NVIDIA Container Toolkit
First check that the system sees the card:
nvidia-smiIf you get a table with the card name and the driver version, you are good to go. Now install the NVIDIA Container Toolkit, which lets containers use the GPU. On Debian and Ubuntu, after adding the NVIDIA repository as described in its documentation:
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart dockerA quick test that a container can see the card:
docker run --rm --gpus all ubuntu nvidia-smiStep 2: compose.yaml
Create a directory such as ~/llm and put this file in it:
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
volumes:
- ollama:/root/.ollama
environment:
- OLLAMA_KEEP_ALIVE=30m
- OLLAMA_FLASH_ATTENTION=1
- OLLAMA_KV_CACHE_TYPE=q8_0
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
restart: unless-stopped
ports:
- "3000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
volumes:
- open-webui:/app/backend/data
depends_on:
- ollama
volumes:
ollama:
open-webui:A few things worth knowing:
| Variable | What it does |
|---|---|
OLLAMA_KEEP_ALIVE | how long the model stays in VRAM after the last request |
OLLAMA_FLASH_ATTENTION | a faster and leaner attention implementation |
OLLAMA_KV_CACHE_TYPE | q8_0 roughly halves the memory used by the context |
Start everything:
docker compose up -d
docker compose logs -f ollamaStep 3: your first model
Models are pulled from inside the container:
docker exec -it ollama ollama pull qwen3:8b
docker exec -it ollama ollama run qwen3:8b --verboseThe --verbose flag prints statistics after every answer. The line that matters most is eval rate, the generation speed in tokens per second. On an RTX 3060 12 GB it looks roughly like this:
Qwen3 8B
ollama · RTX 3060 12 GB
- VRAM
- 6.4GB
- Generation
- 58tok/s
- Context
- 8K
Indicative results. Speed depends on context length, drivers and the Ollama version.
Also check that the model really sits entirely on the GPU:
docker exec -it ollama ollama psThe PROCESSOR column should say 100% GPU. If you see something like 35%/65% CPU/GPU, the model or its context does not fit in VRAM and some layers run on the CPU. Speed then drops several times over.
Step 4: Open WebUI
Open http://<server-ip>:3000. The first account you create automatically becomes the administrator, so do it right after the first start. Pick a model from the list at the top and you are done.
Things worth enabling right away:
- Admin Panel → Settings → Users: disable new sign-ups or set the default role to
pending. - Workspace → Models: your own presets with a system prompt, for example "nginx configuration assistant".
- Documents: upload PDFs and notes and let the model answer based on them (RAG).
Step 5: an API for your own scripts
Ollama also speaks the OpenAI API, so most libraries and tools work after changing the base URL. From the host, through the Open WebUI container, or after publishing the port inside a trusted network:
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3:8b",
"messages": [{"role": "user", "content": "Write a haiku about a server room."}]
}'What next
You now have a working, private chat. The usual next steps are a bigger model (how much memory it needs is covered in the article on quantization), a reverse proxy with HTTPS in front of Open WebUI, and automatic container updates. And if Ollama starts holding you back, read the comparison with llama.cpp and vLLM.
FAQ
Does Ollama work without a GPU?
Yes, on the CPU alone. An 8B model then usually generates a few tokens per second, which is fine for testing but not for daily use.
How much VRAM do I need to get started?
8 GB is enough for 7–8B models at Q4. With 12 GB you can comfortably run models up to 14B.
How do I update Ollama and Open WebUI?
Pull the new images with docker compose pull and restart with docker compose up -d. Models and chat history stay in the volumes.


