NVIDIA Docker-初始化错误:NVML错误:驱动程序未加载

问题描述

我是Docker的新手,因此以下问题可能有点天真,但我遇到了麻烦,需要帮助。

我正在尝试重现一些研究成果。作者只是released code along with a specification of how to build a Docker image来重现他们的结果。相关位复制如下:

enter image description here

我相信我正确安装了Docker:

$ docker --version
Docker version 19.03.13,build 4484c46d9d
$ sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message,Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client,which sent it
    to your terminal.

To try something more ambitious,you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images,automate workflows,and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas,visit:
 https://docs.docker.com/get-started/

但是,当我尝试检查我的nvidia-docker安装是否成功时,出现以下错误:

$ sudo docker run --gpus all --rm nvidia/cuda:10.1-base nvidia-smi
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 0 caused \\\"error running hook: exit status 1,stdout:,stderr: nvidia-container-cli: initialization error: nvml error: driver not loaded\\\\n\\\"\"": unknown.

看起来关键错误是:

nvidia-container-cli: initialization error: nvml error: driver not loaded

我本地没有GPU,我发现有关在NVIDIA Docker之前是否需要安装CUDA的矛盾信息。例如,this NVIDIA moderator says“正确的nvidia docker插件安装始于在基础计算机上的正确CUDA安装。”

我的问题如下:

  1. 是否可以在未安装CUDA的情况下安装NVIDIA Docker?

  2. 如果是,此错误的根源是什么,我该如何解决?

  3. 如果没有,如何创建该Docker映像以重现结果?

解决方法

  1. 是的,可以。 nvidia-docker仅需要安装NVIDIA GPU驱动程序和Docker引擎:https://github.com/NVIDIA/nvidia-docker#getting-started。对于许多人(包括我)来说,安装nvidia-docker的唯一目的是能够避免与CUDA接触:)。
  2. 那是因为您“本地没有GPU”或不是NVIDIA,或者是因为安装了驱动程序而弄乱了某个地方。如果您具有支持CUDA的GPU,建议您使用NVIDIA指南来安装驱动程序。这些指南在详尽程度方面是完整的。
  3. 问题是,即使您设法摆脱了Docker映像中的CUDA,也有软件需要它(您不认为他们添加CUDA是为了娱乐吗?)。因此,您还必须修改代码。在这种情况下,修复Dockerfile在我看来似乎是不必要的-您可以忽略Docker并开始修复代码(如果可能的话)。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...