Skip to content

Instantly share code, notes, and snippets.

@michaelgold
Created July 14, 2025 14:39
Show Gist options
  • Save michaelgold/91102aaf4a1ae60ab72b7888d482c547 to your computer and use it in GitHub Desktop.
Save michaelgold/91102aaf4a1ae60ab72b7888d482c547 to your computer and use it in GitHub Desktop.
# configure the docker 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.list
# update the repository
sudo apt-get update
# Install the NVIDIA Container Toolkit packages:
export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.17.8-1
sudo apt-get install -y \
nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
# Restart the Docker daemon:
sudo nvidia-ctk runtime configure --runtime=docker
# Configure the container runtime by using the nvidia-ctk command:
nvidia-ctk runtime configure --runtime=docker --config=$HOME/.config/docker/daemon.json
# Restart the Rootless Docker daemon:
systemctl --user restart docker
# Configure /etc/nvidia-container-runtime/config.toml by using the sudo nvidia-ctk command:
sudo nvidia-ctk config --set nvidia-container-cli.no-cgroups --in-place
# Run a sample workload
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment