container

package
v1.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseArgs

func ParseArgs(c *cli.Context, o *Options) error

ParseArgs parses the command line arguments to the CLI

Types

type Options

type Options struct {
	Config        string
	Socket        string
	RuntimeName   string
	RuntimeDir    string
	SetAsDefault  bool
	RestartMode   string
	HostRootMount string
}

Options defines the shared options for the CLIs to configure containers runtimes.

func (Options) Configure

func (o Options) Configure(cfg engine.Interface) error

Configure applies the options to the specified config

func (Options) Restart

func (o Options) Restart(service string, withSignal func(string) error) error

Restart restarts the specified service

func (Options) RevertConfig

func (o Options) RevertConfig(cfg engine.Interface) error

RevertConfig reverts the specified config to remove the nvidia runtimes

func (Options) SystemdRestart

func (o Options) SystemdRestart(service string) error

SystemdRestart restarts the specified service using systemd

func (Options) Unconfigure

func (o Options) Unconfigure(cfg engine.Interface) error

Unconfigure removes the options from the specified config

func (Options) UpdateConfig

func (o Options) UpdateConfig(cfg engine.Interface) error

UpdateConfig updates the specified config to include the nvidia runtimes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL