Loading…
Loading documentation...
Serve Ollama, Open WebUI, and vLLM cleanly in Docker Compose with internal network isolation, auth lock-downs, GPU memory caps, and Caddy HTTPS proxying.
Commands checked on 2026-11-23 with Ollama 0.5+, vLLM 0.6+, Open WebUI 0.5+, Caddy 2.9, Ubuntu 24.04.
A production-hardened self-hosted AI inference stack pairing Open WebUI with Ollama and vLLM over an internal: true Docker bridge so model management ports (11434, 8000) are never exposed publicly, signup abuse is blocked by default, and streaming SSE responses pass cleanly through Caddy HTTPS.
nvidia-ctk --version); see Managed Docker first stack.proxy_net; see Configure Caddy and Traefik reverse proxies reliably.Unauthenticated Ollama (11434) or vLLM (8000) ports allow arbitrary attackers to run inference or trigger massive model pulls. Keep both engines strictly on ai_internal (internal: true) and never publish raw ports: on them:
networks:
ai_internal:
internal: true
proxy_net:
external: true
Use an internal API key between Open WebUI and vLLM/OpenAI-compatible backends, set DEFAULT_USER_ROLE=pending (and ENABLE_SIGNUP=false after registering your own admin account), and pin memory ceilings for CPU fallback hosts:
services:
ollama:
image: ollama/ollama:latest
container_name: ai-ollama
restart: unless-stopped
volumes:
- ollama_data:/root/.ollama
environment:
- OLLAMA_KEEP_ALIVE=12h
- OLLAMA_NUM_PARALLEL=2
- OLLAMA_MAX_LOADED_MODELS=1
networks:
- ai_internal
deploy:
resources:
limits:
memory: 14G
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: ai-open-webui
restart: unless-stopped
depends_on:
- ollama
volumes:
- open_webui_data:/app/backend/data
environment:
- OLLAMA_BASE_URL=http://ollama:11434
- WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY}
- WEBUI_AUTH=true
- ENABLE_SIGNUP=true
- DEFAULT_USER_ROLE=pending
networks:
- ai_internal
- proxy_net
For GPU nodes using NVIDIA GPUs, add runtime: nvidia and limit gpu-memory-utilization=0.85 on vLLM so KV-cache allocation leaves headroom without CUDA OOM crashes.
Generate WEBUI_SECRET_KEY=$(openssl rand -hex 32), start the stack, and create your first admin user privately before routing public DNS or set ENABLE_SIGNUP=false once your team accounts are created:
docker compose up -d
docker exec ai-ollama ollama pull qwen2.5-coder:7b
docker exec ai-ollama ollama pull nomic-embed-text
chat.YOUR_DOMAIN {
reverse_proxy ai-open-webui:8080 {
flush_interval -1
transport http {
response_header_timeout 300s
}
}
}
Verify that backend inference ports are unreachable externally while Open WebUI responds cleanly behind HTTPS and lists your local Ollama models:
sudo ss -tulpn | grep -E ':(11434|8000)\b' || echo "Backends isolated cleanly"
docker exec ai-ollama ollama list
curl -fsS https://chat.YOUR_DOMAIN/health
Ollama connection failed at startup. Both containers must share ai_internal, and OLLAMA_BASE_URL must point to http://ollama:11434 (never http://localhost:11434, which resolves to the Open WebUI container itself).ollama tried loading an oversized quantized model into RAM. Match quantization (e.g., Q4_K_M) so model weights plus KV cache stay under 70% of free host memory and set vm.swappiness=10.flush_interval -1 in Caddy or proxy_buffering off; in Nginx.ENABLE_SIGNUP=false right after initial administrator provisioning to eliminate anonymous free-rider inference abuse./var/run/docker.sock inside chat UI containers unless you explicitly require local code execution.Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.