To install the Nvidia Docker Container Toolkit, you need to add its repository (“PPA”) to the package sources, update the sources and then start the installation:
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.list
sudo apt update
sudo apt install -y nvidia-container-toolkit
Afterwards you need to configure the container-runtime:
sudo nvidia-ctk runtime configure --runtime=docker
And finally you need to reboot the docker service:
sudo systemctl restart docker