ubuntu22.04下安装nvidia-docker

首先需要保证docker engine已经安装成功,具体见:

https://www.cnblogs.com/devilmaycry812839668/p/17269122.html

 

 

======================================

 

 

nvidia docker的安装参考官方资料:

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installation-guide

 

 

Setting up NVIDIA Container Toolkit

Setup the package repository and the GPG key:

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
      && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
      && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
            sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
            sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

 

 

 

 

 

 

Install the nvidia-container-toolkit package (and dependencies) after updating the package listing:

sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit

 

 

 

 

Configure the Docker daemon to recognize the NVIDIA Container Runtime:

sudo nvidia-ctk runtime configure --runtime=docker

 

 

 

 

Restart the Docker daemon to complete the installation after setting the default runtime:

sudo systemctl restart docker

 

 

 

 

 

At this point, a working setup can be tested by running a base CUDA container:

sudo docker run --rm --runtime=nvidia --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi

 

 

 

========================================

 

 

This should result in a console output shown below:

安装成功。

 

 

=================================================

 

 

 

posted on 2023-03-29 15:50  Angry_Panda  阅读(1831)  评论(0编辑  收藏  举报

导航