No gpu capabilities with docker that has cuda and a windows host that also has cuda

I have pulled a container from this image wihch has already cuda and opencv installed. I build the image in vscode but when i type:

I get the following error:

NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

have in my host windows os installed cuda, the necessary drives and nvidia-container-toolkit. If i run “nvidia-smi” in host cmd, i get:nvidia-smi in windows

I have defined in daemon.json in docker desktop the following:

  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
  "default-runtime": "nvidia",
  "experimental": true,
  "log-driver": "json-file",
  "log-opts": {
    "max-file": "20",
    "max-size": "10m"
  "runtimes": {
    "nvidia": {
      "args": [],
      "path": "C:\\Users\\M\\Documents\\nvidia-container-toolkit-main\\test\\input\\nvidia-container-runtime"

And i have defined in my systems path the “C:\Users\M\Documents\nvidia-container-toolkit-main\test\input\nvidia-container-runtime” as it is where the config.toml is located

When i run docker info it is detecting the runtime file but inside the container i still have no cuda and if i run in windows cmd docker run --gpus 1 myimage nvidia-smi i get the follwing error:

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: unable to retrieve OCI runtime error (open /var/run/desktop-containerd/daemon/io.containerd.runtime.v2.task/moby/ef0ae52403c5b564014b6557d613720e7607d6d86d196870f802efd5a05941c0/log.json: no such file or directory): exec: “C:\Users\M\Documents\nvidia-container-toolkit-main\test\input\nvidia-container-runtime”: executable file not found in $PATH: unknown.

I have not yet seen the solution to this problem as i have already used what i have seen in different forums.

I would really appreaciate your help as i am kind of stuck