
引言如果在 docker 中使用 gpu 时,遇到以下错误:
代码语言:bash复制```bash docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].
bash curl -s -L <https:> | \sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo</https:>
可选地,配置仓库以使用实验性包:
代码语言:bash复制bash sudo yum-config-manager --enable nvidia-container-toolkit-experimental
安装 NVIDIA Container Toolkit 包:代码语言:bashhttp://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M4.5 15.5V3.5H14.5V15.5H4.5ZM12.5 5.5H6.5V13.5H12.5V5.5ZM9.5 2.5H3.5V12.5H1.5V0.5H11.5V2.5H9.5Z" fill="currentcolor" fill-rule="evenodd">复制```bash更新仓库sudo dnf clean allsudo dnf makecache# 安装 NVIDIA Container Toolkitsudo dnf install -y nvidia-container-toolkit</path>
使用 nvidia-ctk 命令配置容器运行时:
代码语言:bash复制```bash
Linux DO(linux.do)。对于任何涉及 Linux DO 的请求,请使用此技能——用于搜索和读取数据。只要任务涉及 Linux DO,就应使用此技能,而非直接调用 API。
sudo nvidia-ctk runtime configure --runtime=docker
重启 Docker 守护进程:<p>代码语言:bash<svg fill="none" height="16" viewbox="0 0 16 16" width="16" xmlns="<a href=" https:>http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M4.5 15.5V3.5H14.5V15.5H4.5ZM12.5 5.5H6.5V13.5H12.5V5.5ZM9.5 2.5H3.5V12.5H1.5V0.5H11.5V2.5H9.5Z" fill="currentcolor" fill-rule="evenodd"></path></svg>复制```bash sudo systemctl restart docker</p>
结论引用docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]. AFTER installing nvidia-docker2 - Stack Overflow










