Skip to content

Commit b072b64

Browse files
authored
skip standalone runner init when --openaiurl is provided (#842)
Commands wrapped with withStandaloneRunner were unconditionally calling ensureStandaloneRunnerAvailable before RunE executed, causing a Docker socket connection attempt even when --openaiurl was supplied and no local daemon is needed. Check for the openaiurl flag in the wrapper and bypass runner initialization when it is set. Signed-off-by: Eric Curtin <eric.curtin@docker.com>
1 parent 388a9fd commit b072b64

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

cmd/cli/commands/install-runner.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,13 @@ func withStandaloneRunner(cmd *cobra.Command) *cobra.Command {
186186
}
187187
originalRunE := cmd.RunE
188188
cmd.RunE = func(cmd *cobra.Command, args []string) error {
189-
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
190-
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
189+
// Skip standalone runner initialization when --openaiurl is provided,
190+
// since those commands talk directly to an external endpoint and don't
191+
// need (or have) a local Docker daemon.
192+
if f := cmd.Flag("openaiurl"); f == nil || f.Value.String() == "" {
193+
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
194+
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
195+
}
191196
}
192197
return originalRunE(cmd, args)
193198
}

0 commit comments

Comments
 (0)