安装使用 nvidia docker
首先确保你自己电脑/服务器中安装了nvidia驱动。
安装方法
distribution=(. /etc/os-release;echoIDVERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
测试是否安装成功
docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
如果能正常显示显卡相关信息就表示安装成功了。
如果出现:
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook
0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: driver rpc error: timed out: unknown.
可以选择开启GPU持续模式即可,:
nvidia-persistenced --persistence-mode