Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit 6cb1e6c

Browse files
authored
Merge pull request #91 from docker/model-runner-environment
Inform standalone installations of their operating environment.
2 parents b7339bc + de1a461 commit 6cb1e6c

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

commands/install-runner.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,12 @@ func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.Sta
126126

127127
// Create the model runner container.
128128
port := uint16(standalone.DefaultControllerPortMoby)
129+
environment := "moby"
129130
if engineKind == desktop.ModelRunnerEngineKindCloud {
130131
port = standalone.DefaultControllerPortCloud
132+
environment = "cloud"
131133
}
132-
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, false, gpu, modelStorageVolume, printer); err != nil {
134+
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, environment, false, gpu, modelStorageVolume, printer); err != nil {
133135
return nil, fmt.Errorf("unable to initialize standalone model runner container: %w", err)
134136
}
135137

@@ -188,6 +190,12 @@ func newInstallRunner() *cobra.Command {
188190
port = standalone.DefaultControllerPortCloud
189191
}
190192

193+
// Set the appropriate environment.
194+
environment := "moby"
195+
if engineKind == desktop.ModelRunnerEngineKindCloud {
196+
environment = "cloud"
197+
}
198+
191199
// Create a Docker client for the active context.
192200
dockerClient, err := desktop.DockerClientForContext(dockerCLI, dockerCLI.CurrentContext())
193201
if err != nil {
@@ -230,7 +238,7 @@ func newInstallRunner() *cobra.Command {
230238
return fmt.Errorf("unable to initialize standalone model storage: %w", err)
231239
}
232240
// Create the model runner container.
233-
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, doNotTrack, gpu, modelStorageVolume, cmd); err != nil {
241+
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, environment, doNotTrack, gpu, modelStorageVolume, cmd); err != nil {
234242
return fmt.Errorf("unable to initialize standalone model runner container: %w", err)
235243
}
236244

pkg/standalone/containers.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func determineBridgeGatewayIP(ctx context.Context, dockerClient *client.Client)
6767
}
6868

6969
// CreateControllerContainer creates and starts a controller container.
70-
func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, port uint16, doNotTrack bool, gpu gpupkg.GPUSupport, modelStorageVolume string, printer StatusPrinter) error {
70+
func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, port uint16, environment string, doNotTrack bool, gpu gpupkg.GPUSupport, modelStorageVolume string, printer StatusPrinter) error {
7171
// Determine the target image.
7272
var imageName string
7373
switch gpu {
@@ -79,7 +79,10 @@ func CreateControllerContainer(ctx context.Context, dockerClient *client.Client,
7979

8080
// Set up the container configuration.
8181
portStr := strconv.Itoa(int(port))
82-
env := []string{"MODEL_RUNNER_PORT=" + portStr}
82+
env := []string{
83+
"MODEL_RUNNER_PORT=" + portStr,
84+
"MODEL_RUNNER_ENVIRONMENT=" + environment,
85+
}
8386
if doNotTrack {
8487
env = append(env, "DO_NOT_TRACK=1")
8588
}

0 commit comments

Comments
 (0)