Back to Cookbook
BeginnerDocker 5 min read

Docker Compose LLM Stack: Ollama + Open WebUI

A production-ready Docker Compose stack that gives you a local ChatGPT experience with one command.

DockerOllamaOpen WebUIComposeGGUF

The complete docker-compose.yml

This stack runs Ollama as the backend and Open WebUI as the ChatGPT-like frontend.

yaml
version: "3.8"
services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    volumes:
      - ollama_data:/root/.ollama
    restart: unless-stopped
    # For NVIDIA GPU:
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    ports:
      - "3000:8080"
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
    depends_on:
      - ollama
    volumes:
      - webui_data:/app/backend/data
    restart: unless-stopped

volumes:
  ollama_data:
  webui_data:

Start and pull a model

Bring up the stack, then pull your first model into the running Ollama container.

bash
docker compose up -d
# Open http://localhost:3000 in your browser

# Pull a model into the running container
docker exec ollama ollama pull llama3.1:8b
Deployment guides are educational. Each model is subject to its own license — read the official Hugging Face model card before downloading or deploying.