(1)确保NVIDIA Drivers和Docker已经安装好
$nvcc --version
$docker
(2)安装nvidia-docker
(2.1)设置stable存储库和密钥
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
(2.2)安装nvidia-docker安装包
$ sudo apt-get install -y nvidia-docker2
(2.3)重启docker
$ sudo systemctl restart docker
(2.4)验证
$ sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi