针对docker容器无法使用gpu的问题

首先,确保宿主机安装好了GPU显卡驱动(这里GPU显卡驱动一般是指Nvidia显卡),通过命令:

nvidia-smi -l

可以检测是否正常。但启动docker时,发现找不到gpu驱动,命令如下:

docker run --name archlinux_for_cnangel -dit --gpus all --privileged=true --net=host -v home_cnangel:/home/cnangel -v /home/cnangel:/data -v /u:/u harbor.huhoo.net:4330/os/archlinux:latest /bin/bash

此时需要安装nvidia-docker2,它会自动带起2个重要的依赖(nvidia-container-toolkit和libnvidia-container-tools)安装:

dnf install nvidia-docker2 -y

然后重新运行上述docker run即可。

Monthly Archives

Pages

Powered by Movable Type 8.0.2

About this Entry

This page contains a single entry by Cnangel published on November 11, 2023 7:25 PM.

如何在fedora39上使用钉钉 was the previous entry in this blog.

clickhouse 数据损坏的跳过方法 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.