docker 19.03已经正式发布了,这次发布对我来说有两大亮点。
就是docker不需要root权限来启动和运行了
就是支持GPU的增强功能,我们在docker里面想读取nvidia显卡再也不需要额外的安装nvidia-docker了
安装NVIDIA Container Runtime
cat nvidia-container-runtime-script.sh
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
$ sh nvidia-container-runtime-script.sh
$ sudo apt-get install nvidia-container-runtime
$ which nvidia-container-runtime-hook
# /usr/bin/nvidia-container-runtime-hook
$ docker run -it --rm --gpus all nvidia/cuda:10.0-base nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.165.02 Driver Version: 418.165.02 CUDA Version: 10.2 |
| -------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| ===============================+======================+======================|
| 0 Tesla P100-SXM2... Off | 00000000:04:00.0 Off | 0 |
| N/A 30C P0 42W / 300W | 0MiB / 16280MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
| 1 Tesla P100-SXM2... Off | 00000000:06:00.0 Off | 0 |
| N/A 27C P0 41W / 300W | 0MiB / 16280MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
| 2 Tesla P100-SXM2... Off | 00000000:07:00.0 Off | 0 |
| N/A 30C P0 39W / 300W | 0MiB / 16280MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
| 3 Tesla P100-SXM2... Off | 00000000:08:00.0 Off | 0 |
| N/A 28C P0 33W / 300W | 0MiB / 16280MiB | 5% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
| =============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+