Docker 中的 CUDA 版本与 WSL2 后端不匹配
我正在尝试将 docker(适用于 Windows 10 Pro 的 Docker Desktop)与 WSL2 后端(WINDOWS SUBSHELL LINUX (WSL) (Ubuntu 20.04.4 LTS)
)结合使用。
该部分似乎工作正常,但我想将我的 GPU (Nvidia RTX A5000
) 传递到我的 docker 容器。
在我做到这一点之前,我仍在尝试进行设置。 我发现了一个非常好的教程,旨在18.04,但发现所有步骤与 20.04 相同,只是版本号有所不同。
最后,我可以看到我的 Cuda 版本不匹配。您可以在这里看到 。
真正的问题是当我尝试运行测试命令 如 docker 网站所示:
docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
我收到此错误:
--> docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380:
starting container process caused: process_linux.go:545: container init caused: Running
hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli:
requirement error: unsatisfied condition: cuda>=11.6, please update your driver to a
newer version, or use an earlier cuda container: unknown.
...我只是不知道该怎么办,或者我该如何解决这个问题。
有人可以解释一下如何让 GPU 成功传递到 docker 容器吗?
I am trying to use docker (Docker Desktop for Windows 10 Pro) with the WSL2 Backend (WINDOWS SUBSHELL LINUX (WSL) (Ubuntu 20.04.4 LTS)
).
That part seems to be working fine, except I would like to pass my GPU (Nvidia RTX A5000
) through to my docker container.
Before I even get that far, I am still trying to set things up. I found a very good tutorial aimed at 18.04, but found all the steps are the same for 20.04, just with some version numbers bumpede.
At the end, I can see that my Cuda versions do not match. You can see that here, .
The real issue is when I try to run the test command as shown on the docker website:
docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
I get this error:
--> docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380:
starting container process caused: process_linux.go:545: container init caused: Running
hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli:
requirement error: unsatisfied condition: cuda>=11.6, please update your driver to a
newer version, or use an earlier cuda container: unknown.
... and I just don't know what to do, or how I can fix this.
Can someone explain how to get the GPU to pass through to a docker container successfully.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我尝试运行容器时,我在 Ubuntu 上遇到了同样的问题:
就我而言,当我尝试启动 docker 映像时,它会发生,该映像的 nvidia cuda 版本高于我的主机上安装的版本。
当我检查主机上安装的 cuda 版本时,我发现它是版本 11.3。
因此,当我尝试运行相同的 cuda 版本(11.3)时,它运行良好:
I had the same issue on Ubuntu when I tried to run the container:
In my case it occurred when I tried to launch docker image that have nvidia cuda version which is higher than what was installed on my host.
When I checked my cuda version that was installed on my host I have found that it is version 11.3.
So when I try to run the same cuda version (11.3) it works well:
来自的评论@RobertCrovella 解决了这个问题:
下载最新的 Nvidia 驱动程序:
现在我可以支持 CUDA 11.6,并且 docker 文档中的测试现在可以工作:
感谢您的快速回复!
The comment from @RobertCrovella resolved this:
Downloading the most current Nvidia driver:
Now I am able to support CUDA 11.6, and the test from the docker documentation now works:
Thank you for the quick response!