How nvidia/nvidia-container-toolkit works
Components
• Driver and Host Environment:
– A node representing the underlying host system, which must have the NVIDIA driver installed. This component is essential since many of the runtime and hook operations depend on NVIDIA driver capabilities.
• External Library – libnvidia-container:
• NVIDIA Container Toolkit Core:
▪ Command-Line Utilities (located under “cmd”):
– nvidia-cdi-hook, nvidia-container-runtime-hook, nvidia-ctk-installer, nvidia-ctk, etc.
– Each utility handles different tasks (e.g., creating symlinks, updating ldconfig, injection of hooks).
▪ Internal Libraries:
– “internal” directory contains modules that manage configuration (internal/config), device discovery (internal/discover), CUDA utilities (internal/cuda), logging, system-level operations (internal/system), and modification logic.
– “pkg” directory modules (like pkg/config and pkg/nvcdi) further encapsulate runtime configurations and NVIDIA CDI (Container Device Interface) logic.
▪ OCI Hooks:
– Representation for integration with container runtimes (Docker, containerd, CRI-O). The toolkit uses OCI hook configurations (located in pkg/config/ocihook and internal/oci) to modify container specifications to allow GPU access.
• Packaging and Deployment:
– Include a section for packaging (in the “packaging” directory and “deployments”) to show how the toolkit is built into container images or native packages.
• CI/CD and Testing:
– Represent the continuous integration workflows (.github/workflows, .gitlab-ci.yml) and tests (in tests and internal/test). Indicate that automated tests, release scripts, and build pipelines verify the toolkit.
Technologies / Frameworks
• The project is written in Golang (as evidenced by .go files and go.mod/go.sum).
• It relies on container and OCI standards.
• CI/CD pipelines are configured using GitHub Actions, GitLab CI, and other scripts (see .github/workflows and hack/ scripts).