From 659c16d299679c2e327363a332936e4439d92e05 Mon Sep 17 00:00:00 2001 From: Bart Sjerps Date: Thu, 4 Jun 2026 16:15:13 +0200 Subject: [PATCH] initial --- compose.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 compose.yml diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..eabda7a --- /dev/null +++ b/compose.yml @@ -0,0 +1,43 @@ +services: + ollama: + image: ollama/ollama:${OLLAMA_IMAGE_TAG:-latest} + container_name: ollama + restart: unless-stopped + + # Keep it local by default, expose it later if you need to. + ports: + - "${OLLAMA_BIND_IP:-127.0.0.1}:11434:11434" + deploy: # For GPU + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu] + + # Persistent models and server state. + volumes: + - ollama:/root/.ollama + + environment: + # The official image already defaults to 0.0.0.0:11434 inside the container, + # but keeping it explicit helps when you override things later. + - OLLAMA_HOST=0.0.0.0:11434 + + # Service tuning. + - OLLAMA_KEEP_ALIVE=${OLLAMA_KEEP_ALIVE:-5m} + - OLLAMA_NUM_PARALLEL=${OLLAMA_NUM_PARALLEL:-1} + - OLLAMA_MAX_LOADED_MODELS=${OLLAMA_MAX_LOADED_MODELS:-1} + + # Optional, but relevant when a browser-based UI talks to Ollama directly. + # See the Networking section for why this exists. + - OLLAMA_ORIGINS=${OLLAMA_ORIGINS:-} + + # GPU reservation is a separate section below. + # Add it only on hosts that actually have NVIDIA GPUs. + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=compute,utility + - OLLAMA_FLASH_ATTENTION=1 # Optional: better performance + +volumes: + ollama: {}