启动容器启动gpu报错

sudo docker run -itd --name joint-train -p 9090:22 --shm-size 32G --gpus all --env="DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix 10e7a6213e29 /bin/bash
8037341bfd071e9b274cf3ebfee870ce6a3eef83d0e23dfc4c26a4233701eeb6
docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].

 

解决方案

apt-get install nvidia-container-runtime

sudo apt-get install -y nvidia-container-toolkit

如果安装失败,就执行下面

curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
  sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | \
  sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update


systemctl restart docker

就可以了

你可能感兴趣的:(启动容器启动gpu报错)