Deploying Local LLMs with Docker: The Complete Stack

Deploying Local LLMs with Docker: The Complete Stack

Docker is the cleanest way to deploy local LLMs for persistent, reproducible service. Containerized Ollama, Open WebUI, and supporting services can be defined in a single docker-compose.yml, making setup repeatable and updates trivial. Here's a production-ready Docker stack for local AI.

Why Docker for LLMs: Isolation prevents dependency conflicts, volumes persist models across container updates, and compose makes multi-service orchestration reproducible. For hardware that runs this stack efficiently, check LLMHardware.io's server build guides.

docker-compose.yml for Ollama + Open WebUI

The compose file defines Ollama with GPU passthrough (runtime: nvidia and NVIDIA_VISIBLE_DEVICES: all), a named volume for model storage, and Open WebUI connected to Ollama's internal service name. Setting restart: unless-stopped on both services ensures everything comes back up after a reboot. The compose network isolates the services while allowing controlled external access.

NVIDIA GPU Passthrough

Prerequisite: install NVIDIA Container Toolkit on the host: sudo apt install nvidia-container-toolkit && sudo systemctl restart docker. For AMD GPUs, use devices: [/dev/kfd, /dev/dri] and the ROCm-enabled Ollama image. Apple Silicon doesn't support Docker GPU passthrough (Metal is host-only) — run Ollama directly on macOS instead of in Docker.

Adding Traefik for Remote Access

Adding a Traefik reverse proxy container to the compose stack gives you HTTPS, automatic Let's Encrypt certificates, and host-based routing — turning your home AI server into a proper service accessible from anywhere. Combine with Tailscale (also runnable as a Docker sidecar) for zero-configuration VPN access without opening ports on your router. This three-container stack (Ollama + Open WebUI + Tailscale) is the recommended home AI server setup in 2025.

Comments

Popular posts from this blog

AMD RX 9070 XT for Local LLMs: ROCm Performance Guide (2026)

llama.cpp flash attention: how to enable and benchmark

SillyTavern with Local LLMs: Complete Setup for AI Companions