首页 > IT职业 > IT职场 > 安装NVIDIA-DOCKER

nvidia-gpu-docker
nouveau 是系统自带的一个显示驱动程序,需要先将其禁用,然后再进行下一步操作,否则在安装显卡驱动时,会提示:You appear to be running an X server …,然后安装失败。分别打开如下两个文件(如果没有就创建一个),并在其中输入如下两句,然后保存。
vim /etc/modprobe.d/nvidia-installer-disable-nouveau.conf vim /lib/modprobe.d/nvidia-installer-disable-nouveau.conf blacklist nouveau options nouveau modeset=0
太容易忽略
# 资料 https://unix.stackexchange.com/questions/115289/driver-install-kernel-source-not-foundyum -y install kernel-devel kernel-header
# 直接这么安装,别折腾了。apt install docker
# 别折腾了 哥yum install docker
Ubuntu will install docker.io by default which isn't the latest version of Docker Engine. This implies that you will need to pin the version of nvidia-docker. See more information here.
# If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containersdocker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f
sudo apt-get purge -y nvidia-docker# Add the package repositoriescurl -s -L https://nvidia.github.io/nvidia-docker/gpgkey |
sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list |
sudo tee /etc/apt/sources.list.d/nvidia-docker.listsudo apt-get update# Install nvidia-docker2 and reload the Docker daemon configurationsudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd# Test nvidia-smi with the latest official CUDA imagedocker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
If you are not using the official docker-ce package on CentOS/RHEL, use the next section.
# If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containersdocker 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 repositoriesdistribution=$(. /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 configurationsudo yum install -y nvidia-docker2
sudo pkill -SIGHUP dockerd# Test nvidia-smi with the latest official CUDA imagedocker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
If yum reports a conflict on /etc/docker/daemon.json with the docker package, you need to use the next section instead.
For docker-ce on ppc64le, look at the FAQ.
# If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containersdocker 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 repositoriesdistribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.repo |
sudo tee /etc/yum.repos.d/nvidia-container-runtime.repo# Install the nvidia runtime hooksudo yum install -y nvidia-container-runtime-hook# Test nvidia-smi with the latest official CUDA image# You can't use `--runtime=nvidia` with this setup.docker run --rm nvidia/cuda:9.0-base nvidia-smi
查找可安装的nvidia docker版本
yum search --showduplicates nvidia-docker
最终输出结果是下面这张图:
查找可安装的nvidia docker版本
yum search --showduplicates nvidia-docker1
最终输出结果是下面这张图:
这里写图片描述
大家可以从中选择自己需要安装的nvidia docker版本,这里我安装的是docker是1.12.6版本的。因此我选择安装倒数第一个版本的nvidia docker。
可以去参考资料1去看博客.
作者:大大大大峰哥
链接:https://www.jianshu.com/p/f25ccedb996e
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/835/viewspace-2820702/ ,如需转载,请注明出处,否则将追究法律责任。