Nvidia runtime in a gitlab-ci service

Hello, I have a service which loads docker daemon docker and I want to utilize nvidia gpus inside this service, I have created an image which has a dockerd as entrypoint and installed nvidia cuda driver but when I am trying to deploy my application for test purposes I am facing errors related with nvidia driver inside the service’s image

docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused “process_linux.go:449: container init caused “process_linux.go:432: running prestart hook 1 caused \“error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request\\n\”””: unknown.

#image: chatzich/dinvidia
stages:
  - test
  - package

before_script:
  - echo "Before script section"

after_script:
  - echo "After script section"


test:
  image: chatzich/dinvidia
  services:
    - name: chatzich/dinvidia
      alias: dinvidia
  stage: build
  variables:
    DOCKER_HOST: tcp://dinvidia:2375
    DOCKER_DRIVER: overlay2
    DOCKER_TLS_CERTDIR: ""
    
  tags:
    - gpu

  script:
    # Build the production image
    - echo "Build stage script"
    - ldconfig -p | grep nvidia
    - docker --version
    - docker run --rm --runtime=nvidia nvidia/cuda ldconfig -p | grep nvidia
  

  stage: test
  
package:
  stage: package
  script:
    # Build the production image
    - echo "Package stage script"
1 Like