现在慢慢进入GPU的世界,
参考安装URL:
https://github.com/NVIDIA/nvidia-docker
# If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containers docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f sudo yum remove nvidia-docker # Add the package repositories distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | \ sudo tee /etc/yum.repos.d/nvidia-docker.repo # Install nvidia-docker2 and reload the Docker daemon configuration sudo yum install -y nvidia-docker2 sudo pkill -SIGHUP dockerd # Test nvidia-smi with the latest official CUDA image docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
如果在centos和redhat之间切换,就要灵活定义distribution变量了。
~~~~~~~~~~~~~~~~~~~~~~~~~
第一步,先安装nvidia-docker2吧。
由于公司特殊情况,手工下载rpm。
现在nvidia-docker2默认支持的是比较新的18.09.6的docker-ce版本。
先安装好这个版本之后,再使用yum downloadonly命令,下载所有的rpm包。
yum install --downloadonly nvidia-docker2 --downloaddir=/tmp/nvidia
输出如下:
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package nvidia-docker2.noarch 0:2.0.3-3.docker18.09.6.ce will be installed --> Processing Dependency: nvidia-container-runtime = 2.0.0-3.docker18.09.6 for package: nvidia-docker2-2.0.3-3.docker18.09.6.ce.noarch --> Running transaction check ---> Package nvidia-container-runtime.x86_64 0:2.0.0-3.docker18.09.6 will be installed --> Processing Dependency: nvidia-container-runtime-hook < 2.0.0 for package: nvidia-container-runtime-2.0.0-3.docker18.09.6.x86_64 --> Running transaction check ---> Package nvidia-container-runtime-hook.x86_64 0:1.4.0-2 will be installed --> Processing Dependency: libnvidia-container-tools < 2.0.0 for package: nvidia-container-runtime-hook-1.4.0-2.x86_64 --> Processing Dependency: libnvidia-container-tools >= 0.1.0 for package: nvidia-container-runtime-hook-1.4.0-2.x86_64 --> Running transaction check ---> Package libnvidia-container-tools.x86_64 0:1.0.2-1 will be installed --> Processing Dependency: libnvidia-container1(x86-64) >= 1.0.2-1 for package: libnvidia-container-tools-1.0.2-1.x86_64 --> Processing Dependency: libnvidia-container.so.1(NVC_1.0)(64bit) for package: libnvidia-container-tools-1.0.2-1.x86_64 --> Processing Dependency: libnvidia-container.so.1()(64bit) for package: libnvidia-container-tools-1.0.2-1.x86_64 --> Running transaction check ---> Package libnvidia-container1.x86_64 0:1.0.2-1 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================== Installing: nvidia-docker2 noarch 2.0.3-3.docker18.09.6.ce nvidia-docker 4.7 k Installing for dependencies: libnvidia-container-tools x86_64 1.0.2-1 libnvidia-container 33 k libnvidia-container1 x86_64 1.0.2-1 libnvidia-container 74 k nvidia-container-runtime x86_64 2.0.0-3.docker18.09.6 nvidia-container-runtime 2.7 M nvidia-container-runtime-hook x86_64 1.4.0-2 nvidia-container-runtime 616 k Transaction Summary ===================================================================================================================================================================== Install 1 Package (+4 Dependent packages) Total size: 3.4 M Installed size: 13 M Background downloading packages, then exiting: exiting because "Download Only" specified
-rw-r--r-- 1 root root 23217684 May 29 10:23 containerd.io-1.2.5-3.1.el7.x86_64.rpm -rw-r--r-- 1 root root 19628160 May 29 10:21 docker-ce-18.09.6-3.el7.x86_64.rpm -rw-r--r-- 1 root root 14689460 May 29 10:21 docker-ce-cli-18.09.6-3.el7.x86_64.rpm -rw-r--r-- 1 root root 75516 Mar 26 12:00 libnvidia-container1-1.0.2-1.x86_64.rpm -rw-r--r-- 1 root root 33688 Mar 26 12:00 libnvidia-container-tools-1.0.2-1.x86_64.rpm -rw-r--r-- 1 root root 2821452 May 17 05:53 nvidia-container-runtime-2.0.0-3.docker18.09.6.x86_64.rpm -rw-r--r-- 1 root root 630948 May 17 05:53 nvidia-container-runtime-hook-1.4.0-2.x86_64.rpm -rw-r--r-- 1 root root 4796 May 17 05:54 nvidia-docker2-2.0.3-3.docker18.09.6.ce.noarch.rpm
来源:https://www.cnblogs.com/aguncn/p/10942292.html