- 只需要安装Docker Engine
- Installing the NVIDIA Container Toolkit — NVIDIA Container Toolkit 1.16.0 documentation
Installing with Apt
- Configure the production repository:
$ 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/stable/deb/nvidia-container-toolkit.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.listOptionally, configure the repository to use experimental packages:
$ sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list
- Update the packages list from the repository:
$ sudo apt-get update - Install the NVIDIA Container Toolkit packages:
$ sudo apt-get install -y nvidia-container-toolkit
Configuring Docker
-
Configure the container runtime by using the
nvidia-ctkcommand:$ sudo nvidia-ctk runtime configure --runtime=dockerThe
nvidia-ctkcommand modifies the/etc/docker/daemon.jsonfile on the host. The file is updated so that Docker can use the NVIDIA Container Runtime. -
Restart the Docker daemon: 3
$ sudo systemctl restart docker