1. 程式人生 > >centos7 安裝 NVIDIA Docker

centos7 安裝 NVIDIA Docker

path download x86_64 proc nbsp error mkdir fan dea

安裝環境:

1、centos7.3

2、NVIDIA Corporation GP106 [GeForce GTX 1060 6GB]

安裝nvidia-docker

a、安裝docker 可參考centos7 安裝docker

b:

# Install nvidia-docker and nvidia-docker-plugin
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker-1.0.1-1.x86_64.rpm
sudo rpm -i /tmp/nvidia-docker*.rpm && rm /tmp/nvidia-docker*.rpm
sudo systemctl start nvidia
-docker # Test nvidia-smi nvidia-docker run --rm nvidia/cuda nvidia-smi

如果出現異常:

[[email protected] ~]# nvidia-docker run --rm nvidia/cuda nvidia-smi
/usr/bin/docker-current: Error response from daemon: create nvidia_driver_384.69: create nvidia_driver_384.69: Error looking up volume plugin nvidia-docker: plugin not found.
See 
‘/usr/bin/docker-current run --help‘.

則檢查nvidia-docker是否啟動:

[[email protected] ~]# systemctl status nvidia-docker
● nvidia-docker.service - NVIDIA Docker plugin
   Loaded: loaded (/usr/lib/systemd/system/nvidia-docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: https:
//github.com/NVIDIA/nvidia-docker/wiki [[email protected] ~]# systemctl start nvidia-docker [[email protected] ~]# systemctl status nvidia-docker ● nvidia-docker.service - NVIDIA Docker plugin Loaded: loaded (/usr/lib/systemd/system/nvidia-docker.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2017-08-30 03:18:32 CST; 5s ago Docs: https://github.com/NVIDIA/nvidia-docker/wiki Process: 11135 ExecStartPost=/bin/sh -c /bin/echo unix://$SOCK_DIR/nvidia-docker.sock > $SPEC_FILE (code=exited, status=0/SUCCESS) Process: 11131 ExecStartPost=/bin/sh -c /bin/mkdir -p $( dirname $SPEC_FILE ) (code=exited, status=0/SUCCESS) Main PID: 11130 (nvidia-docker-p) CGroup: /system.slice/nvidia-docker.service └─11130 /usr/bin/nvidia-docker-plugin -s /var/lib/nvidia-docker Aug 30 03:18:32 localhost.localdomain systemd[1]: Starting NVIDIA Docker plugin... Aug 30 03:18:32 localhost.localdomain systemd[1]: Started NVIDIA Docker plugin. Aug 30 03:18:32 localhost.localdomain nvidia-docker-plugin[11130]: /usr/bin/nvidia-docker-plugin | 2017/08/30 03:18:32 Loading NV...mory Aug 30 03:18:32 localhost.localdomain nvidia-docker-plugin[11130]: /usr/bin/nvidia-docker-plugin | 2017/08/30 03:18:32 Loading NV...rary Aug 30 03:18:33 localhost.localdomain nvidia-docker-plugin[11130]: /usr/bin/nvidia-docker-plugin | 2017/08/30 03:18:33 Discoverin...ices Aug 30 03:18:33 localhost.localdomain nvidia-docker-plugin[11130]: /usr/bin/nvidia-docker-plugin | 2017/08/30 03:18:33 Provisioni...umes Aug 30 03:18:33 localhost.localdomain nvidia-docker-plugin[11130]: /usr/bin/nvidia-docker-plugin | 2017/08/30 03:18:33 Serving pl...cker Aug 30 03:18:33 localhost.localdomain nvidia-docker-plugin[11130]: /usr/bin/nvidia-docker-plugin | 2017/08/30 03:18:33 Serving re...3476 Hint: Some lines were ellipsized, use -l to show in full. [[email protected] ~]# nvidia-docker run --rm nvidia/cuda nvidia-smi Tue Aug 29 19:18:46 2017 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 384.69 Driver Version: 384.69 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 106... Off | 00000000:01:00.0 Off | N/A | | 43% 39C P0 22W / 120W | 10MiB / 6072MiB | 0% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+

如果出現以下情況:

[[email protected] ~]# nvidia-docker run --rm nvidia/cuda nvidia-smi
NVIDIA-SMI couldn‘t find libnvidia-ml.so library in your system. Please make sure that the NVIDIA Display Driver is properly installed and present in your system.
Please also try adding directory that contains libnvidia-ml.so to your system PATH.key

可以嘗試一下加參數--privileged=true ,如果沒問題,則需要修改selinux配置,編輯/etc/selinux/config:

SELINUX=disabled 
SELINUXTYPE=targeted

或者嘗試selinux模式為permissive模式 setenforce 0

重啟機器,重啟服務器即可。

可參考:

https://github.com/NVIDIA/nvidia-docker/issues/407

https://github.com/NVIDIA/nvidia-docker

centos7 安裝 NVIDIA Docker