@@ -204,7 +204,12 @@ func Install(cli *cli.Context, opts *options) error {
204204 return fmt .Errorf ("error installing NVIDIA container runtime hook: %v" , err )
205205 }
206206
207- err = installToolkitConfig (toolkitConfigPath , nvidiaContainerCliExecutable , opts )
207+ nvidiaCTKPath , err := installContainerToolkitCLI (opts .toolkitRoot )
208+ if err != nil {
209+ return fmt .Errorf ("error installing NVIDIA Container Toolkit CLI: %v" , err )
210+ }
211+
212+ err = installToolkitConfig (toolkitConfigPath , nvidiaContainerCliExecutable , nvidiaCTKPath , opts )
208213 if err != nil {
209214 return fmt .Errorf ("error installing NVIDIA container toolkit config: %v" , err )
210215 }
@@ -262,7 +267,7 @@ func installLibrary(libName string, toolkitRoot string) error {
262267
263268// installToolkitConfig installs the config file for the NVIDIA container toolkit ensuring
264269// that the settings are updated to match the desired install and nvidia driver directories.
265- func installToolkitConfig (toolkitConfigPath string , nvidiaContainerCliExecutablePath string , opts * options ) error {
270+ func installToolkitConfig (toolkitConfigPath string , nvidiaContainerCliExecutablePath string , nvidiaCTKPath string , opts * options ) error {
266271 log .Infof ("Installing NVIDIA container toolkit config '%v'" , toolkitConfigPath )
267272
268273 config , err := toml .LoadFile (nvidiaContainerToolkitConfigSource )
@@ -311,6 +316,9 @@ func installToolkitConfig(toolkitConfigPath string, nvidiaContainerCliExecutable
311316 config .Set (key , value )
312317 }
313318
319+ // Set nvidia-ctk options
320+ config .Set ("nvidia-ctk.path" , nvidiaCTKPath )
321+
314322 _ , err = config .WriteTo (targetConfig )
315323 if err != nil {
316324 return fmt .Errorf ("error writing config: %v" , err )
@@ -322,6 +330,19 @@ func installToolkitConfig(toolkitConfigPath string, nvidiaContainerCliExecutable
322330 return nil
323331}
324332
333+ // installContainerToolkitCLI installs the nvidia-ctk CLI executable and wrapper.
334+ func installContainerToolkitCLI (toolkitDir string ) (string , error ) {
335+ e := executable {
336+ source : "/usr/bin/nvidia-ctk" ,
337+ target : executableTarget {
338+ dotfileName : "nvidia-ctk.real" ,
339+ wrapperName : "nvidia-ctk" ,
340+ },
341+ }
342+
343+ return e .install (toolkitDir )
344+ }
345+
325346// installContainerCLI sets up the NVIDIA container CLI executable, copying the executable
326347// and implementing the required wrapper
327348func installContainerCLI (toolkitRoot string ) (string , error ) {
0 commit comments