Created
May 18, 2026 15:30
-
-
Save katallaxie/173672d42993fcaa1979030aa796fd7e to your computer and use it in GitHub Desktop.
Docker Compose file for Ollama ROCm GPU usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Docker Compose file for Ollama ROCm GPU usage | |
| # Tested on Minisforum N5 Pro (should work on similar AMD ROCm systems) | |
| version: '3.9' | |
| services: | |
| ollama: | |
| container_name: ollama | |
| # --- GPU devices for ROCm --- | |
| devices: | |
| - /dev/dri:/dev/dri # DRM device for graphics | |
| - /dev/kfd:/dev/kfd # ROCm kernel driver | |
| # --- Drop unnecessary capabilities, limit privileges --- | |
| cap_drop: | |
| - ALL | |
| security_opt: | |
| - no-new-privileges=true | |
| privileged: false | |
| # --- Resource limits --- | |
| deploy: | |
| resources: | |
| limits: | |
| cpus: '4' | |
| memory: 40960M # 40GB RAM limit | |
| # --- Environment variables --- | |
| environment: | |
| HSA_OVERRIDE_GFX_VERSION: 9.0.0 # Ensures ROCm sees the correct GPU architecture | |
| NVIDIA_VISIBLE_DEVICES: void # Explicitly disable NVIDIA runtime | |
| OLLAMA_HOST: 0.0.0.0:11434 # Listen address for Ollama API | |
| TZ: Etc/UTC # Timezone | |
| UMASK: '002' # File creation mask | |
| UMASK_SET: '002' | |
| # --- Group permissions for GPU access --- | |
| group_add: | |
| - 44 # video group | |
| - 107 # render group | |
| - 568 # AMD-specific | |
| # --- Healthcheck to verify container is up --- | |
| healthcheck: | |
| interval: 10s | |
| retries: 30 | |
| start_period: 10s | |
| timeout: 5s | |
| test: timeout 1 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/11434' | |
| # --- Image --- | |
| image: ollama/ollama:0.30.0-rc7-rocm # Full GPU usage image | |
| platform: linux/amd64 | |
| # --- Network and port mapping --- | |
| ports: | |
| - mode: ingress | |
| protocol: tcp | |
| published: 11434 | |
| target: 11434 | |
| # --- Interactive / TTY settings --- | |
| stdin_open: false | |
| tty: false | |
| user: '0:0' # Run as root inside container (necessary for ROCm device access) | |
| # --- Restart policy --- | |
| restart: unless-stopped | |
| # --- Persistent data mount --- | |
| volumes: | |
| - bind: | |
| source: /mnt/Storage/apps/ollama | |
| target: /root/.ollama | |
| type: bind | |
| read_only: false | |
| propagation: rprivate | |
| # --- Named volumes section --- | |
| volumes: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment