This repository contains a Docker Compose setup for running Open WebUI with Ollama, providing a complete local AI chat interface with GPU acceleration support.
This setup includes:
- Open WebUI: A user-friendly web interface for interacting with AI models
- Ollama: A local AI model server for running large language models
- GPU Support: NVIDIA GPU acceleration for faster inference
- Docker and Docker Compose installed
- NVIDIA GPU (optional, for GPU acceleration)
- NVIDIA Container Toolkit (if using GPU)
- Clone or download this repository
- Navigate to the project directory
- Copy the environment file and modify as needed:
cp .env.example .env
- Start the services:
docker compose up -d
- Access Open WebUI at: http://localhost:3000
Copy .env.example to .env and modify the following variables as needed:
OPEN_WEBUI_VERSION: Open WebUI version (default: v0.6.26)OLLAMA_VERSION: Ollama version (default: 0.11.8)OPEN_WEBUI_PORT: Host port for Open WebUI (default: 3000)OLLAMA_PORT: Host port for Ollama API (default: 11434)OLLAMA_BASE_URL: Override for external Ollama instance (optional)
- Open WebUI runs on port 3000
- Ollama API runs on port 11434
- GPU acceleration is enabled by default (NVIDIA)
If you're running Ollama on your host machine instead of in a container:
- Set
OLLAMA_BASE_URL=http://host.docker.internal:11434in your.envfile - Comment out or remove the ollama service section in docker-compose.yaml
- Remove the ollama dependency from the open-webui service
# Start in detached mode
docker compose up -d
# Start with logs visible
docker compose updocker compose down# View all logs
docker compose logs
# View logs for specific service
docker compose logs open-webui
docker compose logs ollamaOnce the services are running, you can install models through the Open WebUI interface or directly via Ollama:
# Install a model via Ollama container
docker exec -it ollama ollama pull llama2
# List installed models
docker exec -it ollama ollama listThe setup uses named volumes to persist all important data across container restarts and updates:
-
ollama: Stores downloaded AI models, model configurations, and Ollama settings- Location:
/root/.ollamainside the container - Contains: All pulled models (e.g., llama2, codellama, etc.), model metadata, and Ollama configuration
- Location:
-
open-webui: Stores all Open WebUI application data- Location:
/app/backend/datainside the container - Contains: User accounts, user settings, chat histories, custom prompts, knowledge bases, and application configuration
- Location:
- User accounts and authentication data
- All chat conversations and history
- User preferences and interface settings
- Downloaded Ollama models (can be large, 4GB+ per model)
- Custom prompts and templates
- Knowledge bases and uploaded documents
- Application configuration and settings
- Data persists even when containers are stopped, updated, or recreated
- Volumes are only deleted when explicitly removed with
docker compose down -v - To backup your data, you can backup these Docker volumes
- Models downloaded through Open WebUI interface are automatically stored in the ollama volume
The configuration includes NVIDIA GPU support with the following settings:
- Driver: nvidia
- Device IDs: all available GPUs
- Capabilities: gpu
If you don't have an NVIDIA GPU, you can remove the deploy section from the ollama service.
-
Port conflicts: If the configured ports are already in use, modify
OPEN_WEBUI_PORTorOLLAMA_PORTin your.envfile -
GPU not working: Ensure you have the NVIDIA Container Toolkit installed:
# Ubuntu/Debian sudo apt-get update sudo apt-get install -y nvidia-container-toolkit sudo systemctl restart docker -
Open WebUI can't connect to Ollama: Check that both services are running and the OLLAMA_BASE_URL is correct
-
Environment file not found: Make sure you've copied
.env.exampleto.env
The Ollama service includes a health check. You can verify the status:
docker compose ps- Open WebUI: http://localhost:3000 (or your configured
OPEN_WEBUI_PORT) - Ollama API: http://localhost:11434 (or your configured
OLLAMA_PORT)
This setup is intended for local private use only and is not production ready.