docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]. AFTER installing nvidia-docker2
Asked Answered
S

3

16

I followed the instructions to install the nvidia-docker2 from the official documentation https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html

Whenever I run their test example:

sudo docker run --rm --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi

I still get the error:

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]. 3

I rebooted but still no effect.

I am on Ubuntu 22.04 with my nvidia drivers updated. Nvidia-smi works on the machine but not working using docker

EDIT (SOLVED): Finally I found out what was going on. When reinstalling, it was working, however if rebooting, it was going again to a previous state where it was not working.

This was due to the installation of another docker service installed using "snapd" so I had to purge completely docker: sudo snap remove docker and after I could "Reinstall everything" and it finally is stable, even after rebooting

Shipmate answered 14/1, 2023 at 15:17 Comment(0)
M
50

I have the same issue. I have noticed that, I did not installed 'NVIDIA Container Toolkit'. After installing the container toolkit, it works. The official instruction is available in : https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

  1. Configure the repository:
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey |sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list \
&& sudo apt-get update
  1. Install the NVIDIA Container Toolkit packages:
sudo apt-get install -y nvidia-container-toolkit
  1. Configure the container runtime by using the nvidia-ctk command:
sudo nvidia-ctk runtime configure --runtime=docker
  1. Restart the Docker daemon:
sudo systemctl restart docker
Mcghee answered 10/10, 2023 at 21:33 Comment(2)
Upvoted, but please, put your commands in a code blockThomasinathomasine
It worked!!! Thank you so much.Kissel
S
2

Unfortunately I was not able to "Fix" properly the issue so I purge all docker package and all nvidia container packages and reinstalled everything and now it works!!

Good old methods work fine :)

Shipmate answered 14/1, 2023 at 16:15 Comment(2)
happy for you .Waddington
Adding code or commands to your answer would adhere to the guidelines ! :)Hilde
T
0

This issue is usually observed when CUDA toolkit is not installed though the driver is installed.

Step by step instruction for doing installation for Ubuntu (apt based), and other variants (yum, dnf) is provided in https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

Theomachy answered 12/2 at 7:16 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Minded

© 2022 - 2024 — McMap. All rights reserved.