【centos7 Nvidia docker安装】

nvidia安装流程 驱动安装

换yum源

  477  sudo yum update

  451  wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

  479  ls

  480  mv CentOS7-Base-163.repo  /etc/yum.repos.d

  481  yum install wget

  476  sudo yum clean all

  464  yum makecache

1.

https://www.nvidia.cn/download/driverResults.aspx/209273/cn/

Linux x64 (AMD64/EM64T) Display Driver | 535.86.05 | Linux 64-bit | NVIDIA

驱动下载

sudo yum -y install vulkan

nice -n 19 tar -czvf root_backup.tar.gz /

sudo tar -czvf system_backup.tar.gz --exclude=/data /

sudo yum install -y net-tools

sudo docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-centos7 nvidia-smi

# 查看版本

   37  cat /etc/centos-release

   39  sudo yum install epel-release

   45  sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm

No package docker-ce available.怎么解决

   66  sudo yum install -y yum-utils

   67  sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

   68  sudo yum install -y docker-ce

删除旧的docker版本

   69  sudo yum remove docker-1.13.1-209.git7d71120.el7.centos.x86_64

   70  sudo yum clean all

   71  sudo yum install -y yum-utils

   72  sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

   73  sudo yum install -y docker-ce

   74  sudo yum remove docker-common-2:1.13.1-209.git7d71120.el7.centos.x86_64

   75  sudo yum clean all

   76  sudo yum install -y yum-utils

   77  sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

   78  sudo yum install -y docker-ce

   79  sudo systemctl start docker

   80  sudo systemctl enable docker

   81  docker

   82  distribution=$(. /etc/os-release;echo $ID$VERSION_ID)

   83  curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo |   sudo tee /etc/yum.repos.d/nvidia-docker.repo

   84  sudo yum install -y nvidia-docker2

   85  sudo systemctl restart docker

下载镜像

   93  docker pull nvidia/cuda:12.2.0-runtime-centos7

   95  sudo docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-centos7 nvidia-smi

sudo docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-centos7 nvidia-smi执行报错怎么处理, 原因缺乏驱动程序

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'

nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory: unknown.

   96  distribution=$(. /etc/os-release;echo $ID$VERSION_ID)

   97  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

   98  sudo yum install -y nvidia-container-toolkit

   99  sudo systemctl restart docker

  100  sudo docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-centos7 nvidia-smi

sudo docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-centos7 nvidia-smi执行报错: 没有安装驱动

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'

nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory: unknown.

  101  sudo systemctl restart docker

  102  sudo docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-centos7 nvidia-smi

校验是否成功安装驱动

  103  nvidia-smi

安装驱动过程中问题

Unable to find the development tool cc in your path" 错误,这意味着系统缺少必要的编译工具,可能没有安装 gcc 包。

  160  tar -xzvf cmake-3.27.1-linux-x86_64.tar.gz

  165  vi ~/.bashrc

c17支持

  264  scl enable devtoolset-9 bash

Unable to find the kernel source tree for the

         currently running kernel.  Please make sure    

         you have installed the kernel source files for

         your kernel and that they are properly         

         configured; on Red Hat Linux systems, for      

         example, be sure you have the 'kernel-source'

         or 'kernel-devel' RPM installed.  If you know

         the correct kernel source files are installed,

         you may specify the kernel source path with    

         the '--kernel-source-path' command line        

         option.centos mini 安装nvidia驱动提示这个怎么解决

系统无法找到当前运行的内核的源代码树。为了解决这个问题,你需要确保已经安装了当前运行内核的源代码

uname -r

   25  sudo yum install gcc

   28  sudo yum install kernel-devel-3.10.0-1160.el7.x86_64

nvidia-installer was forced to guess the X   

           library path '/usr/lib64' and X module path

           '/usr/lib64/xorg/modules'; these paths were

           not queryable from the system.  If X fails   

           to find the NVIDIA X driver module, please   

           install the `pkg-config` utility and the     

           X.Org SDK/development package for your       

           distribution and reinstall the driver.centos mini 安装nvidia驱动提示这个怎么解决

这个错误提示表明 NVIDIA 安装程序无法自动确定 X 库和 X 模块的路径,因此它只能猜测这些路径。如果 X 在查找 NVIDIA X 驱动模块时失败,可能是因为缺少 pkg-config 工具以及 X.Org SDK/development 包。

   29  sudo yum install pkgconfig

   30  sudo yum install libX11-devel

   31  sudo yum install pkgconfig

   32  sudo yum install libX11-devel

This NVIDIA driver package includes Vulkan   

           components, but no Vulkan ICD loader was     

           detected on this system. The NVIDIA Vulkan   

           ICD will not function without the loader.    

           Most distributions package the Vulkan        

           loader; try installing the "vulkan-loader",

           "vulkan-icd-loader", or "libvulkan1"         

           package.  centos mini 安装nvidia驱动提示这个怎么解决

这个错误提示表示在安装 NVIDIA 驱动时,虽然驱动包中包含了 Vulkan 组件,但系统上没有检测到 Vulkan ICD(Installable Client Driver)加载器。Vulkan ICD加载器是用于加载和管理Vulkan驱动程序的组件。

  510  sudo yum -y install vulkan

  511  vulkaninfo

  518  nvidia-smi

### 在 CentOS 7.9 上安装 NVIDIA 支持的 Docker 要在 CentOS 7.9 上成功安装并配置支持 NVIDIADocker,需完成以下几个方面的操作: #### 准备工作 为了确保环境能够正常运行 NVIDIA GPU 加速的应用程序,需要先确认系统已正确安装 NVIDIA 驱动程序。可以通过以下命令验证驱动版本: ```bash nvidia-smi ``` 如果未安装或无法识别显卡,则需要按照官方文档下载适合系统的 NVIDIA 驱动程序[^1]。 #### 安装必要的依赖项 在安装 Docker 前,需要准备一些基础工具和库文件。通过 `yum` 工具可以快速获取这些组件: ```bash yum install -y yum-utils device-mapper-persistent-data lvm2 ``` 上述命令会自动拉取所需的管理工具以及存储设备的支持模块[^2]。 #### 下载并安装 Docker CE (Community Edition) 对于稳定版的 Docker 社区发行版,可以从官网静态链接地址手动获取二进制文件,并将其解压至指定目录以便后续调用: ```bash wget https://download.docker.com/linux/static/stable/x86_64/docker-<version>.tgz tar xzvf docker-<version>.tgz cp docker/* /usr/bin/ ``` 这里 `<version>` 应替换为目标具体版本号,例如 `20.10.17`[^3]。 #### 启用 NVIDIA 运行时支持 为了让容器内部能访问宿主机上的图形处理单元资源,还需要额外设置启用 nvidia-container-toolkit 插件服务。执行如下脚本初始化环境变量路径映射关系: ```bash distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list apt-get update && apt-get install -y nvidia-docker2 systemctl restart docker ``` 最后一步非常重要——重启 Docker daemon 才能使新的 runtime 生效。 至此,整个流程结束之后就可以创建带有 gpu 参数选项的新实例来测试功能是否生效啦!
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值