junli@ubuntu16:~$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:1d.0/0000:3c:00.0 ==
manual_install: True
model : GM108M [GeForce 940MX]
modalias : pci:v000010DEd0000134Dsv000017AAsd000039C8bc03sc02i00
vendor : NVIDIA Corporation
driver : nvidia-418 - third-party free
driver : nvidia-410 - third-party free
driver : nvidia-430 - third-party free recommended
driver : nvidia-415 - third-party free
driver : nvidia-384 - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
junli@ubuntu16:~$ docker --version
Docker version 20.10.7, build f0df350
可安装CUDA11.0以下的版本
junli@ubuntu16:~$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
junli@ubuntu16:~$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
junli@ubuntu16:~$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
junli@ubuntu16:~$ sudo apt-get update
junli@ubuntu16:~$ sudo apt-get install -y nvidia-docker2
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会同时安装下列软件:
libnvidia-container-tools libnvidia-container1 nvidia-container-toolkit
下列【新】软件包将被安装:
......
/sbin/ldconfig.real: /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn.so.7 is not a symbolic link
junli@ubuntu16:~$ sudo systemctl restart docker
根据主机条件获取镜像网址
junli@ubuntu16:~$ docker pull nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04
junli@ubuntu16:~$ docker run --runtime=nvidia --rm nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04 nvidia-smi
Tue Aug 2 06:38:49 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.57 Driver Version: 450.57 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce 940MX Off | 00000000:3C:00.0 Off | N/A |
| N/A 41C P0 N/A / N/A | 0MiB / 2004MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+