# Nvidia docker container runtime doesn't detect my gpu

**URL:** https://discourse.nixos.org/t/nvidia-docker-container-runtime-doesnt-detect-my-gpu/51336
**Category:** Help
**Created:** [August 29, 2024, 8:51pm UTC](https://discourse.nixos.org/t/nvidia-docker-container-runtime-doesnt-detect-my-gpu/51336 "2024-08-29T20:51:37Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![ereslibre](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ereslibre/32/28000_2.png) [@ereslibre](https://discourse.nixos.org/u/ereslibre)
#### Post date: [November 26, 2024, 3:26pm UTC](https://discourse.nixos.org/t/nvidia-docker-container-runtime-doesnt-detect-my-gpu/51336/15 "2024-11-26T15:26:21Z")

</div>

Hello @Traktorbek!

You need to adapt your docker-compose file so that it uses the CDI driver, like documented in [Nixpkgs Reference Manual](https://nixos.org/manual/nixpkgs/unstable/#using-docker-compose). In your case, it should be along the lines:

```yaml
pipeline:
  image: '${DOCKER_IMAGE_PIPELINE?Variable not set}:${TAG-latest}'
  build:
    target: development
    context: ./pipeline
    args:
      - PIPELINE_BASE_IMAGE=${PIPELINE_BASE_IMAGE}
  environment:
    - CONFIG_PATH=${PIPELINE_CONFIG_PATH}
  runtime: ${DOCKER_RUNTIME:-runc}
  restart: always
  deploy:
    resources:
      reservations:
        devices:
        - driver: cdi
          device_ids:
          - nvidia.com/gpu=all

```

Note that this will expose all your GPU’s to the container, if they are being identified by their ID, and you wanted to expose only ID’s 0 and 1, you could do:

```yaml
pipeline:
  image: '${DOCKER_IMAGE_PIPELINE?Variable not set}:${TAG-latest}'
  build:
    target: development
    context: ./pipeline
    args:
      - PIPELINE_BASE_IMAGE=${PIPELINE_BASE_IMAGE}
  environment:
    - CONFIG_PATH=${PIPELINE_CONFIG_PATH}
  runtime: ${DOCKER_RUNTIME:-runc}
  restart: always
  deploy:
    resources:
      reservations:
        devices:
        - driver: cdi
          device_ids:
          - nvidia.com/gpu=0
          - nvidia.com/gpu=1

```

---

_[View the full topic](https://discourse.nixos.org/t/nvidia-docker-container-runtime-doesnt-detect-my-gpu/51336)._
