nvidia-container-toolkit/tools/container
Evan Lezar cc4c2783a3 Add --create-device-nodes option to toolkit config
This change adds a --create-device-nodes option to the toolkit config CLI.
Most noteably, this allows the creation of control devices to be skipped
when CDI spec generation is enabled.

Currently values of "", "node", and "control" are supported and can be set
via the command line flag or the CREATE_DEVICE_NODES environment variable.

The default value of CREATE_DEVICE_NODES=control will trigger the creation
of control device nodes. Setting this envvar to include the (comma-separated)
strings of "" or "none" will disable device node creation regardless of
whether other supported strings are included.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
2024-02-13 12:37:41 +01:00
..
containerd run goimports -local against the entire codebase 2023-12-01 11:13:17 +01:00
crio run goimports -local against the entire codebase 2023-12-01 11:13:17 +01:00
docker run goimports -local against the entire codebase 2023-12-01 11:13:17 +01:00
nvidia-toolkit Add nolint for exec calls 2023-10-24 20:11:34 +02:00
operator Remove NVIDIA experimental runtime from toolkit container 2023-07-10 11:44:55 +02:00
toolkit Add --create-device-nodes option to toolkit config 2024-02-13 12:37:41 +01:00
container.go run goimports -local against the entire codebase 2023-12-01 11:13:17 +01:00
README.md Remove NVIDIA experimental runtime from toolkit container 2023-07-10 11:44:55 +02:00

Introduction

This repository contains tools that allow docker, containerd, or cri-o to be configured to use the NVIDIA Container Toolkit.

Note: These were copied from the container-config repository are being migrated to commands installed with the NVIDIA Container Toolkit.

These will be migrated into an upcoming nvidia-ctk CLI as required.

Docker

After building the docker binary, run:

docker setup \
    --runtime-name NAME \
        /run/nvidia/toolkit

Configure the nvidia-container-runtime as a docker runtime named NAME. If the --runtime-name flag is not specified, this runtime would be called nvidia.

Since --set-as-default is enabled by default, the specified runtime name will also be set as the default docker runtime. This can be disabled by explicityly specifying --set-as-default=false.

The following table describes the behaviour for different --runtime-name and --set-as-default flag combinations.

Flags Installed Runtimes Default Runtime
NONE SPECIFIED nvidia nvidia
--runtime-name nvidia nvidia nvidia
--runtime-name NAME NAME NAME
--set-as-default nvidia nvidia
--set-as-default --runtime-name nvidia nvidia nvidia
--set-as-default --runtime-name NAME NAME NAME
--set-as-default=false nvidia NOT SET
--set-as-default=false --runtime-name NAME NAME NOT SET
--set-as-default=false --runtime-name nvidia nvidia NOT SET

These combinations also hold for the environment variables that map to the command line flags: DOCKER_RUNTIME_NAME, DOCKER_SET_AS_DEFAULT.

Containerd

After running the containerd binary, run:

containerd setup \
    --runtime-class NAME \
        /run/nvidia/toolkit

Configure the nvidia-container-runtime as a runtime class named NAME. If the --runtime-class flag is not specified, this runtime would be called nvidia.

Adding the --set-as-default flag as follows:

containerd setup \
    --runtime-class NAME \
    --set-as-default \
        /run/nvidia/toolkit

will set the runtime class NAME (or nvidia if not specified) as the default runtime class.

The following table describes the behaviour for different --runtime-class and --set-as-default flag combinations.

Flags Installed Runtime Classes Default Runtime Class
NONE SPECIFIED nvidia NOT SET
--runtime-class NAME NAME NOT SET
--runtime-class nvidia nvidia NOT SET
--set-as-default nvidia nvidia
--set-as-default --runtime-class NAME NAME NAME
--set-as-default --runtime-class nvidia nvidia nvidia

These combinations also hold for the environment variables that map to the command line flags.