ITPub博客

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

安装NVIDIA-DOCKER

IT职场 作者:wyvernw 时间:2021-09-09 10:20:56 0 删除 编辑

图片描述

nvidia-gpu-docker

一、宿主机安装Cuda

1.1 nouveau 驱动问题

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

1.2 GCC问题

太容易忽略

1.3Kernel问题

# 资料 https://unix.stackexchange.com/questions/115289/driver-install-kernel-source-not-foundyum -y install kernel-devel kernel-header

二、Docker 安装

2.1 Ubuntu安装

# 直接这么安装,别折腾了。apt install docker

2.2 Centos安装

# 别折腾了 哥yum install docker

三、NVIDIA-DOCKER

3.1 Ubuntu 14.04/16.04/18.04, Debian Jessie/Stretch

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

3.2 CentOS 7 (docker-ce), RHEL 7.4/7.5 (docker-ce), Amazon Linux 1/2

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.

3.3 CentOS 7 (docker), RHEL 7.4/7.5 (docker)

# 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

3.4 Docker与当前Nvidia-docker版本不一致

查找可安装的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/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-12

  • 博文量
    128
  • 访问量
    1296