nvidia-docker安装

(1)确保NVIDIA Drivers和Docker已经安装好

$nvcc --version

$docker

(2)安装nvidia-docker

(2.1)设置stable存储库和密钥

# 注意此步骤可能无法下载,需要手动去网页下载,然后使用apt-key add 载入

$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -

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

 

# 此步骤可能无法下载nvidia-docker.list,以我的ubuntu22.04为例,我需要去https://nvidia.github.io/nvidia-docker/ubuntu22.04/nvidia-docker.list 中把这里面的内容复制出来,然后创建nvidia-docker.list

$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

$ sudo apt-get update

(2.2)安装nvidia-docker安装包

sudo apt-get install -y nvidia-docker2

(2.3)重启docker

$ sudo systemctl restart docker

(2.4)验证

$ sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

posted @ 2022-12-22 19:47  海_纳百川  阅读(599)  评论(0编辑  收藏  举报
本站总访问量