@@ -19,6 +19,7 @@ package runtime
1919import (
2020 "fmt"
2121
22+ log "github.com/sirupsen/logrus"
2223 "github.com/urfave/cli/v2"
2324
2425 "github.com/NVIDIA/nvidia-container-toolkit/tools/container"
@@ -53,6 +54,12 @@ func Flags(opts *Options) []cli.Flag {
5354 Destination : & opts .Config ,
5455 EnvVars : []string {"RUNTIME_CONFIG" , "CONTAINERD_CONFIG" , "DOCKER_CONFIG" },
5556 },
57+ & cli.StringFlag {
58+ Name : "executable-path" ,
59+ Usage : "The path to the runtime executable. This is used to extract the current config" ,
60+ Destination : & opts .ExecutablePath ,
61+ EnvVars : []string {"RUNTIME_EXECUTABLE_PATH" },
62+ },
5663 & cli.StringFlag {
5764 Name : "socket" ,
5865 Usage : "Path to the runtime socket file" ,
@@ -104,15 +111,20 @@ func Flags(opts *Options) []cli.Flag {
104111 return flags
105112}
106113
107- // ValidateOptions checks whether the specified options are valid
108- func ValidateOptions ( c * cli.Context , opts * Options , runtime string , toolkitRoot string , to * toolkit.Options ) error {
114+ // Validate checks whether the specified options are valid
115+ func ( opts * Options ) Validate ( c * cli.Context , runtime string , toolkitRoot string , to * toolkit.Options ) error {
109116 // We set this option here to ensure that it is available in future calls.
110117 opts .RuntimeDir = toolkitRoot
111118
112119 if ! c .IsSet ("enable-cdi-in-runtime" ) {
113120 opts .EnableCDI = to .CDI .Enabled
114121 }
115122
123+ if opts .ExecutablePath != "" && opts .RuntimeName == docker .Name {
124+ log .Warningf ("Ignoring executable-path=%q flag for %v" , opts .ExecutablePath , opts .RuntimeName )
125+ opts .ExecutablePath = ""
126+ }
127+
116128 // Apply the runtime-specific config changes.
117129 switch runtime {
118130 case containerd .Name :
0 commit comments