Files
portainer-core/stacks/ollama.yml
T
jpmschweitzerandClaude Opus 4.5 75c3950dd8 feat: add Docker healthchecks, remove Uptime Kuma
- Add healthcheck configurations to 13 stacks for Portainer status monitoring
- Remove Uptime Kuma service (replaced by Docker healthchecks)
- Clean up stale Heimdall references
- Update documentation and service counts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 12:05:05 +01:00

79 lines
2.3 KiB
YAML

version: '3.8'
# Ollama - GPU-Accelerated ML Model Serving
# Phase 1: Foundation Setup
# Ports: 11434 (API)
# GPU: YES - Requires NVIDIA Container Toolkit
# Storage: SSD or HDD for models (models are 2-15GB each)
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
ports:
- "11434:11434" # Ollama API endpoint
volumes:
# Model storage - choose based on available space:
# SSD (faster load times): /home/jpmschweitzer/docker-data/ollama/models
# HDD (more space): /mnt/media/ollama/models
- /home/jpmschweitzer/docker-data/ollama/models:/root/.ollama
environment:
- TZ=Europe/Amsterdam
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
# Process requests sequentially to avoid batch overflow panics
- OLLAMA_NUM_PARALLEL=1
# Keep models loaded in VRAM (don't unload after idle)
- OLLAMA_KEEP_ALIVE=-1
# Load multiple models concurrently (mistral-nemo + nomic-embed-text)
- OLLAMA_MAX_LOADED_MODELS=2
healthcheck:
test: ["CMD-SHELL", "curl -fSs http://localhost:11434/api/tags || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
deploy:
resources:
limits:
memory: 8G
reservations:
memory: 1G
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
networks:
- docker-dataplane
networks:
docker-dataplane:
external: true
name: docker-dataplane
# GPU Requirements:
# - RTX 2080 Ti (11GB VRAM)
# - Suitable for 3B-13B parameter models
# - NVIDIA Container Toolkit must be installed
#
# After Deployment:
# 1. Verify GPU access: docker exec ollama nvidia-smi
# 2. Pull a model: docker exec ollama ollama pull llama3.2:3b
# 3. List models: docker exec ollama ollama list
# 4. Test inference: docker exec ollama ollama run llama3.2:3b "Hello"
# 5. Monitor GPU during inference: watch -n 1 nvidia-smi
#
# Recommended Models for RTX 2080 Ti (11GB VRAM):
# - llama3.2:3b (2GB) - Fast, general purpose
# - mistral:7b (4GB) - High quality, coding
# - codellama:7b (4GB) - Code-specialized
# - phi3:mini (2GB) - Fast reasoning
#
# API Usage:
# curl http://localhost:11434/api/generate -d '{
# "model": "llama3.2:3b",
# "prompt": "Why is the sky blue?",
# "stream": false
# }'