From 8194b0e39b016aa3405d4b4f6b26ab185404eee5 Mon Sep 17 00:00:00 2001 From: n0nuser Date: Thu, 9 Jul 2026 06:56:32 +0200 Subject: [PATCH] feat: enable GPU passthrough for ollama container nvidia-container-toolkit wasn't installed on the WSL2 host, so Docker never requested GPU access even though the host driver (nvidia-smi) and WSL2's own CUDA shim worked fine. Ollama fell back to 100% CPU inference, turning a 23-item offline RAGAS eval into a 9+ minute (incomplete) run. Add the compose-level GPU reservation so `docker compose up` requests the GPU once the toolkit is present on the host. Verified: container sees the GPU (nvidia-smi), /api/ps reports non-zero size_vram, and a warm inference call dropped from CPU-bound to ~128 tok/s. Claude-Session: https://claude.ai/code/session_01JUuyBTQaWsVcVygdHhT2iT --- docker-compose.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index fc65ad2..cd2b79d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,13 @@ services: - "11434:11434" volumes: - ollama_data:/root/.ollama + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] healthcheck: test: ["CMD", "ollama", "list"] interval: 10s