Install Nvidia Container Toolkit on Ubuntu


foreword

NVIDIA Container Toolkit is available for various Linux distributions and supports different container engines. Before getting started, make sure you have the NVIDIA drivers installed for your Linux distribution. The recommended way to install the driver is to use the distribution package manager, but other installer mechanisms can also be used (for example, downloading the installer via .run from NVIDIA Driver Downloads)


1. Basic concepts

Nvidia Container Toolkit, which enables Docker containers to interact with the host's Nvidia graphics card. The Ubuntu 18.04, Ubuntu 20.04, and Ubuntu 22.04 releases include support for the Jetson platform as of NVIDIA Container Toolkit 1.7.0. This means that the installation instructions provided for these distributions are expected to work on Jetson devices. nvidia-docker2>=2.8.0

2. Operation steps

1. Add source

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 \
   && curl -s -L https://nvidia.github.io/nvidia-container-runtime/experimental/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list

2. Install restart

sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker

Run nvidia/cuda:10.0-base, if there is no local image, nvidia/cuda:10.0-base image will be pulled from the Internet.

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

insert image description here
Indicates success.


Summarize

This article introduces the process of installing Nvidia Container Toolkit on Ubuntu.

Guess you like

Origin blog.csdn.net/szylight2022/article/details/127302334