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

Commit 8b0acee

Browse files
authored
Merge pull request #83 from doringeman/skip-bridge-binding-dd
Don't bind the bridge gateway IP if we're treating Docker Desktop as Moby
2 parents 7756ae4 + af54bd8 commit 8b0acee

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

desktop/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func DetectContext(ctx context.Context, cli *command.DockerCli) (*ModelRunnerCon
143143

144144
// Check if we're treating Docker Desktop as regular Moby. This is only for
145145
// testing purposes.
146-
treatDesktopAsMoby := os.Getenv("_MODEL_RUNNER_TREAT_DESKTOP_AS_MOBY") != ""
146+
treatDesktopAsMoby := os.Getenv("_MODEL_RUNNER_TREAT_DESKTOP_AS_MOBY") == "1"
147147

148148
// Detect the associated engine type.
149149
kind := ModelRunnerEngineKindMoby

pkg/standalone/containers.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package standalone
33
import (
44
"context"
55
"fmt"
6+
"os"
67
"strconv"
78
"strings"
89

@@ -106,8 +107,11 @@ func CreateControllerContainer(ctx context.Context, dockerClient *client.Client,
106107
},
107108
}
108109
portBindings := []nat.PortBinding{{HostIP: "127.0.0.1", HostPort: portStr}}
109-
if bridgeGatewayIP, err := determineBridgeGatewayIP(ctx, dockerClient); err == nil && bridgeGatewayIP != "" {
110-
portBindings = append(portBindings, nat.PortBinding{HostIP: bridgeGatewayIP, HostPort: portStr})
110+
if os.Getenv("_MODEL_RUNNER_TREAT_DESKTOP_AS_MOBY") != "1" {
111+
// Don't bind the bridge gateway IP if we're treating Docker Desktop as Moby.
112+
if bridgeGatewayIP, err := determineBridgeGatewayIP(ctx, dockerClient); err == nil && bridgeGatewayIP != "" {
113+
portBindings = append(portBindings, nat.PortBinding{HostIP: bridgeGatewayIP, HostPort: portStr})
114+
}
111115
}
112116
hostConfig.PortBindings = nat.PortMap{
113117
nat.Port(portStr + "/tcp"): portBindings,

0 commit comments

Comments
 (0)