nvidia-container-toolkit/cmd/nvidia-cdi-hook
Evan Lezar b3ad04d9f1
Some checks failed
CI Pipeline / code-scanning (push) Has been cancelled
CI Pipeline / variables (push) Has been cancelled
CI Pipeline / golang (push) Has been cancelled
CI Pipeline / image (push) Has been cancelled
CI Pipeline / e2e-test (push) Has been cancelled
Issue warning on unsupported CDI hook
To allow for CDI hooks to be added gradually we provide a generic no-op hook
for unrecognised subcommands. This will log a warning instead of erroring out.

An unsupported hook could be the result of a CDI specification referring to a
new hook that is not yet supported by an older NVIDIA Container Toolkit
version or a hook that has been removed in newer version.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
2025-04-02 16:28:25 +02:00
..
chmod Move nvidia-ctk hook command into own binary 2024-05-21 12:19:44 +02:00
commands Issue warning on unsupported CDI hook 2025-04-02 16:28:25 +02:00
create-symlinks Force symlink creation in create-symlink hook 2024-11-05 09:39:11 -08:00
cudacompat [no-relnote] Fix QF1012: Use fmt.Fprintf(...) instead of WriteString(fmt.Sprintf(...)) lint errors 2025-04-02 14:18:32 +02:00
update-ldcache [no-relnote] Fix QF1012: Use fmt.Fprintf(...) instead of WriteString(fmt.Sprintf(...)) lint errors 2025-04-02 14:18:32 +02:00
main.go Issue warning on unsupported CDI hook 2025-04-02 16:28:25 +02:00
README.md Move nvidia-ctk hook command into own binary 2024-05-21 12:19:44 +02:00

NVIDIA CDI Hook

The CLI nvidia-cdi-hook provides container device runtime hook capabilities when called by a container runtime, as specific in a Container Device Interface file.

Generating a CDI

The CDI itself is created for an NVIDIA-capable device using the nvidia-ctk cdi generate command.

When nvidia-ctk cdi generate is run, the CDI specification is generated as a yaml file. The CDI specification provides instructions for a container runtime to set up devices, files and other resources for the container prior to starting it. Those instructions may include executing command-line tools to prepare the filesystem. The execution of such command-line tools is called a hook.

nvidia-cdi-hook is the CLI tool that is expected to be called by the container runtime, when specified by the CDI file.

See the nvidia-ctk documentation for more information on generating a CDI file.

Functionality

The nvidia-cdi-hook CLI provides the following functionality:

  • chmod - Change the permissions of a file or directory inside the directory path to be mounted into a container.
  • create-symlinks - Create symlinks inside the directory path to be mounted into a container.
  • update-ldcache - Update the dynamic linker cache inside the directory path to be mounted into a container.