Ollama + Open WebUI Docker Setup (2026): Install, Connect and Fix Errors
This guide builds a two-container local AI stack: Ollama runs the model API and Open WebUI provides the browser interface. It uses the connection names and commands in the official Ollama and Open WebUI documentation, then adds a repeatable verification and troubleshooting checklist.
Before you start
- Docker Engine or Docker Desktop with Compose v2: verify with
docker compose version. - At least enough RAM or VRAM for the model tag you choose. Check the model's download size first; runtime memory also depends on context length and concurrency.
- NVIDIA users need the NVIDIA Container Toolkit before Docker can pass the GPU through.
- Do not expose ports
11434or3000to the public internet without authentication, TLS and network controls.
Docker Compose file
Create a new directory and save this as compose.yaml. The services share a private Compose network, so Open WebUI can reach Ollama by the service name ollama.
services:
ollama:
image: ollama/ollama
container_name: ollama
restart: unless-stopped
ports:
- "127.0.0.1:11434:11434"
volumes:
- ollama-data:/root/.ollama
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
restart: unless-stopped
ports:
- "127.0.0.1:3000:8080"
volumes:
- open-webui-data:/app/backend/data
environment:
OLLAMA_BASE_URL: http://ollama:11434
depends_on:
- ollama
volumes:
ollama-data:
open-webui-data:
For a production-like deployment, replace the floating Open WebUI :main tag with a tested release tag from the official release notes. Keep both data volumes in your backup plan.
Start and verify the stack
docker compose pull
docker compose up -d
docker compose ps
curl http://127.0.0.1:11434/api/tags
Open http://localhost:3000. Create the first administrator account. Before making the interface reachable by other users, review signup settings, use a persistent secret, add TLS and restrict network access.
Download and run a local model
The official Ollama quickstart uses gemma3 as an example. You can substitute any current tag from the official model library that fits your hardware.
docker exec -it ollama ollama run gemma3
# List downloaded models
docker exec -it ollama ollama list
# Confirm the HTTP chat API
curl http://127.0.0.1:11434/api/chat -d '{
"model": "gemma3",
"messages": [{"role": "user", "content": "Reply with: stack works"}],
"stream": false
}'
After the model appears in ollama list, refresh Open WebUI. If it does not appear, test the network path from inside the WebUI container:
docker exec open-webui curl -fsS http://ollama:11434/api/tags
NVIDIA GPU Compose addition
After installing and configuring the NVIDIA Container Toolkit, add this block to the ollama service:
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
Recreate the container, then inspect the logs. GPU availability should be proven from runtime output, not assumed from model speed alone.
docker compose up -d --force-recreate ollama
docker compose logs --tail=200 ollama
Force Ollama into local-only mode
Ollama documents two equivalent controls. Add the environment variable to the ollama service:
environment:
OLLAMA_NO_CLOUD: "1"
Or create ~/.ollama/server.json in a native installation:
{
"disable_ollama_cloud": true
}
Restart Ollama and check its logs for confirmation. This disables Ollama cloud models and web search; it does not automatically disable third-party Open WebUI tools or providers.
Common connection errors
| Symptom | Likely cause | Check |
|---|---|---|
| No models in Open WebUI | Wrong Ollama URL or no model downloaded | curl http://ollama:11434/api/tags from the WebUI container. |
Connection refused | Ollama container stopped or wrong hostname | docker compose ps and docker compose logs ollama. |
| Host Ollama is unreachable from Docker | localhost points to the WebUI container | Use http://host.docker.internal:11434; on Linux add the host-gateway mapping. |
| Model is unexpectedly slow | CPU fallback, insufficient memory or excessive context | Inspect Ollama logs and GPU visibility; try a smaller model tag. |
| Settings disappear after recreation | Missing or wrong volume mount | Confirm /app/backend/data and /root/.ollama volumes. |
| Login tokens break across replicas | Inconsistent secret key | Set one persistent WEBUI_SECRET_KEY for every replica. |
Safe update and backup routine
# Back up named volumes before an upgrade
docker run --rm -v open-webui-data:/data -v "$PWD":/backup alpine tar czf /backup/open-webui-data.tgz -C /data .
docker compose pull
docker compose up -d
docker compose ps
docker compose logs --tail=100
Test login, model listing, one chat completion and any external tools after every upgrade. Keep the previous tested image tag available for rollback.
Official references
- Ollama Docker and GPU setup
- Ollama quickstart and API example
- Ollama privacy and local-only controls
- Open WebUI Docker quick start
- Open WebUI connection to Ollama
- Open WebUI environment variables and secret handling
Commands were checked against the linked official documentation on July 31, 2026. Pin versions and test the exact model, driver and container combination you deploy.