diff --git a/commands/install-runner.go b/commands/install-runner.go index 67ceafeb..173bdeb4 100644 --- a/commands/install-runner.go +++ b/commands/install-runner.go @@ -126,10 +126,12 @@ func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.Sta // Create the model runner container. port := uint16(standalone.DefaultControllerPortMoby) + environment := "moby" if engineKind == desktop.ModelRunnerEngineKindCloud { port = standalone.DefaultControllerPortCloud + environment = "cloud" } - if err := standalone.CreateControllerContainer(ctx, dockerClient, port, false, gpu, modelStorageVolume, printer); err != nil { + if err := standalone.CreateControllerContainer(ctx, dockerClient, port, environment, false, gpu, modelStorageVolume, printer); err != nil { return nil, fmt.Errorf("unable to initialize standalone model runner container: %w", err) } @@ -188,6 +190,12 @@ func newInstallRunner() *cobra.Command { port = standalone.DefaultControllerPortCloud } + // Set the appropriate environment. + environment := "moby" + if engineKind == desktop.ModelRunnerEngineKindCloud { + environment = "cloud" + } + // Create a Docker client for the active context. dockerClient, err := desktop.DockerClientForContext(dockerCLI, dockerCLI.CurrentContext()) if err != nil { @@ -230,7 +238,7 @@ func newInstallRunner() *cobra.Command { return fmt.Errorf("unable to initialize standalone model storage: %w", err) } // Create the model runner container. - if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, doNotTrack, gpu, modelStorageVolume, cmd); err != nil { + if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, environment, doNotTrack, gpu, modelStorageVolume, cmd); err != nil { return fmt.Errorf("unable to initialize standalone model runner container: %w", err) } diff --git a/pkg/standalone/containers.go b/pkg/standalone/containers.go index 9858ce37..10e0fac3 100644 --- a/pkg/standalone/containers.go +++ b/pkg/standalone/containers.go @@ -66,7 +66,7 @@ func determineBridgeGatewayIP(ctx context.Context, dockerClient *client.Client) } // CreateControllerContainer creates and starts a controller container. -func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, port uint16, doNotTrack bool, gpu gpupkg.GPUSupport, modelStorageVolume string, printer StatusPrinter) error { +func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, port uint16, environment string, doNotTrack bool, gpu gpupkg.GPUSupport, modelStorageVolume string, printer StatusPrinter) error { // Determine the target image. var imageName string switch gpu { @@ -78,7 +78,10 @@ func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, // Set up the container configuration. portStr := strconv.Itoa(int(port)) - env := []string{"MODEL_RUNNER_PORT=" + portStr} + env := []string{ + "MODEL_RUNNER_PORT=" + portStr, + "MODEL_RUNNER_ENVIRONMENT=" + environment, + } if doNotTrack { env = append(env, "DO_NOT_TRACK=1") }