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

Commit dadaec2

Browse files
authored
Merge pull request #75 from doringeman/metrics
Add `--do-not-track` to disable the metrics tracker
2 parents f4b4581 + 98d5b3c commit dadaec2

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

commands/install-runner.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.Sta
100100
if engineKind == desktop.ModelRunnerEngineKindCloud {
101101
port = standalone.DefaultControllerPortCloud
102102
}
103-
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, gpu, modelStorageVolume, printer); err != nil {
103+
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, false, gpu, modelStorageVolume, printer); err != nil {
104104
return fmt.Errorf("unable to initialize standalone model runner container: %w", err)
105105
}
106106

@@ -111,6 +111,7 @@ func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.Sta
111111
func newInstallRunner() *cobra.Command {
112112
var port uint16
113113
var gpuMode string
114+
var doNotTrack bool
114115
c := &cobra.Command{
115116
Use: "install-runner",
116117
Short: "Install Docker Model Runner (Docker Engine only)",
@@ -182,9 +183,8 @@ func newInstallRunner() *cobra.Command {
182183
if err != nil {
183184
return fmt.Errorf("unable to initialize standalone model storage: %w", err)
184185
}
185-
186186
// Create the model runner container.
187-
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, gpu, modelStorageVolume, cmd); err != nil {
187+
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, doNotTrack, gpu, modelStorageVolume, cmd); err != nil {
188188
return fmt.Errorf("unable to initialize standalone model runner container: %w", err)
189189
}
190190

@@ -196,5 +196,6 @@ func newInstallRunner() *cobra.Command {
196196
c.Flags().Uint16Var(&port, "port", standalone.DefaultControllerPortMoby,
197197
"Docker container port for Docker Model Runner")
198198
c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda)")
199+
c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner")
199200
return c
200201
}

docs/reference/docker_model_install-runner.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ usage: docker model install-runner
66
pname: docker model
77
plink: docker_model.yaml
88
options:
9+
- option: do-not-track
10+
value_type: bool
11+
default_value: "false"
12+
description: Do not track models usage in Docker Model Runner
13+
deprecated: false
14+
hidden: false
15+
experimental: false
16+
experimentalcli: false
17+
kubernetes: false
18+
swarm: false
919
- option: gpu
1020
value_type: string
1121
default_value: auto

docs/reference/model_install-runner.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ Install Docker Model Runner (Docker Engine only)
55

66
### Options
77

8-
| Name | Type | Default | Description |
9-
|:---------|:---------|:--------|:----------------------------------------------|
10-
| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda) |
11-
| `--port` | `uint16` | `12434` | Docker container port for Docker Model Runner |
8+
| Name | Type | Default | Description |
9+
|:-----------------|:---------|:--------|:-------------------------------------------------|
10+
| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner |
11+
| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda) |
12+
| `--port` | `uint16` | `12434` | Docker container port for Docker Model Runner |
1213

1314

1415
<!---MARKER_GEN_END-->

pkg/standalone/containers.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func determineBridgeGatewayIP(ctx context.Context, dockerClient *client.Client)
6666
}
6767

6868
// CreateControllerContainer creates and starts a controller container.
69-
func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, port uint16, gpu gpupkg.GPUSupport, modelStorageVolume string, printer StatusPrinter) error {
69+
func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, port uint16, doNotTrack bool, gpu gpupkg.GPUSupport, modelStorageVolume string, printer StatusPrinter) error {
7070
// Determine the target image.
7171
var imageName string
7272
switch gpu {
@@ -78,11 +78,13 @@ func CreateControllerContainer(ctx context.Context, dockerClient *client.Client,
7878

7979
// Set up the container configuration.
8080
portStr := strconv.Itoa(int(port))
81+
env := []string{"MODEL_RUNNER_PORT=" + portStr}
82+
if doNotTrack {
83+
env = append(env, "DO_NOT_TRACK=1")
84+
}
8185
config := &container.Config{
8286
Image: imageName,
83-
Env: []string{
84-
"MODEL_RUNNER_PORT=" + portStr,
85-
},
87+
Env: env,
8688
ExposedPorts: nat.PortSet{
8789
nat.Port(portStr + "/tcp"): struct{}{},
8890
},

0 commit comments

Comments
 (0)