services.ollama.deploy.resources.reservations.devices.0 missing property 'capabilities' means the device entry in your compose file has no capabilities list (here it had only driver and count). Add capabilities: [gpu] to that device entry and the file validates.

With that one line added, docker compose up -d started the Ollama container on this PC, and its log named the NVIDIA card with library=CUDA.

The error

The compose file, with the GPU block written without capabilities:

services:
  ollama:
    image: ollama/ollama
    container_name: fix9-old-c5-ollama
    ports:
      - "127.0.0.1:15975:11434"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
PS> cmd /c "docker compose -p fix9-old-c5 config 2>&1"; echo exit=$LASTEXITCODE
validating C:\...\c5bad\compose.yaml: services.ollama.deploy.resources.reservations.devices.0 missing property 'capabilities'
exit=1
PS> cmd /c "docker compose -p fix9-old-c5 up -d 2>&1"; echo exit=$LASTEXITCODE
validating C:\...\c5bad\compose.yaml: services.ollama.deploy.resources.reservations.devices.0 missing property 'capabilities'
exit=1

The folder path in the message is shortened; the rest is as printed.

Why it happens

The message starts with validating and the file name: Compose refused the file itself, before Docker or the GPU came into it. The path in the message points at the entry: service ollama, then deploy.resources.reservations.devices, item 0, the first device. Both config and up -d printed only that line and exited with code 1; up -d printed no Network or Container line.

The block is easy to write half way from memory, because driver: nvidia and count: all look like enough to say "give me the GPU".

The fix

    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
PS> cmd /c "docker compose -p fix9-old-c5 config 2>&1"; echo exit=$LASTEXITCODE
name: fix9-old-c5
services:
  ollama:
    deploy:
      resources:
        reservations:
          devices:
            - capabilities:
                - gpu
              driver: nvidia
              count: -1
...
exit=0
PS> cmd /c "docker compose -p fix9-old-c5 up -d 2>&1"; echo exit=$LASTEXITCODE
...
 Container fix9-old-c5-ollama Started
exit=0
PS> cmd /c "docker logs fix9-old-c5-ollama 2>&1" | findstr /C:"inference compute"
time=2026-11-10T03:25:18.524Z level=INFO source=types.go:32 msg="inference compute" id=0 filter_id=0 library=CUDA compute=8.6 name=CUDA0 description="NVIDIA GeForce RTX 3080 Ti Laptop GPU" libdirs=ollama,cuda_v13 driver=13.4 pci_id=0000:01:00.0 type=discrete total="16.0 GiB" available="14.9 GiB"

docker compose config printed count: all as count: -1. Running docker compose config after editing the GPU block is a quick check, because it fails with the same message as up and starts nothing.

The rest of the file needed no change. In the resolved configuration the published port kept host_ip: 127.0.0.1 for port 15975, so the server stayed reachable from this PC only, and docker compose -p fix9-old-c5 down -v removed the container and the project network afterwards.

How it was reproduced

Two folders, each holding one compose.yaml for the cached ollama/ollama:latest image, one without and one with the capabilities line, run with Docker Compose v5.7.0 on Docker Desktop with engine 29.9.3 and the WSL 2 backend, Windows 11, an NVIDIA GeForce RTX 3080 Ti Laptop GPU. The project name fix9-old-c5 and the container name are the test's own; the project was removed with docker compose -p fix9-old-c5 down -v.

Frequently asked

What does missing property 'capabilities' mean in docker compose?
A device entry under deploy.resources.reservations.devices has no capabilities list. Add capabilities: [gpu] to that entry; in this test the file then validated and the container started.
How do I give Ollama the GPU in docker compose?
Under the service add deploy, resources, reservations, devices with one entry of driver: nvidia, count: all and capabilities: [gpu]. The Ollama log then named the card with library=CUDA.
How can I validate a compose file without starting containers?
Run docker compose config in the folder. It printed the same validation message as docker compose up and exited with code 1, and with a valid file it printed the resolved configuration.

To confirm the model itself then runs on the card, read Ollama in Docker shows 100% CPU. More decoded errors in the Fixes category.