version: '3.8' services: ollama: image: ollama/ollama:rocm deploy: replicas: 1 placement: constraints: - node.labels.gpu == true restart_policy: condition: on-failure # We use "host" mode for devices in Swarm to avoid permission headaches # This allows the container to see the /dev/kfd and /dev/dri paths we mount below user: root volumes: - /mnt/local-ssd/docker/ollama:/root/.ollama # Mount the Kernel Fusion Driver (Required for ROCm) - /dev/kfd:/dev/kfd # Mount the Direct Rendering Interface (The actual cards) - /dev/dri:/dev/dri networks: - proxy environment: # Force support for Navi 21 (6900 XT) - HSA_OVERRIDE_GFX_VERSION=10.3.0 # Tell ROCm to verify usage - ROCR_VISIBLE_DEVICES=all - OLLAMA_HOST=0.0.0.0 networks: proxy: external: true