diff --git a/docker-compose.yml b/docker-compose.yml index 0d8f1497475..559b560bfad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,9 +6,9 @@ services: TERM: xterm-256color OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN:-} OPENCLAW_ALLOW_INSECURE_PRIVATE_WS: ${OPENCLAW_ALLOW_INSECURE_PRIVATE_WS:-} - # Docker bridge networks usually do not carry mDNS multicast reliably. - # Set OPENCLAW_DISABLE_BONJOUR=0 only on host/macvlan/mDNS-capable networks. - OPENCLAW_DISABLE_BONJOUR: ${OPENCLAW_DISABLE_BONJOUR:-1} + # Empty means auto: Bonjour disables itself in detected containers. + # Set 0 only on host/macvlan/mDNS-capable networks; set 1 to force off. + OPENCLAW_DISABLE_BONJOUR: ${OPENCLAW_DISABLE_BONJOUR:-} # OpenTelemetry export is outbound OTLP/HTTP from the Gateway. Prometheus # uses the existing authenticated Gateway route; it does not need a port. OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-} diff --git a/scripts/docker/setup.sh b/scripts/docker/setup.sh index d47d7526efd..ab4f2e14d18 100755 --- a/scripts/docker/setup.sh +++ b/scripts/docker/setup.sh @@ -276,7 +276,7 @@ export OPENCLAW_WORKSPACE_DIR export OPENCLAW_GATEWAY_PORT="${OPENCLAW_GATEWAY_PORT:-18789}" export OPENCLAW_BRIDGE_PORT="${OPENCLAW_BRIDGE_PORT:-18790}" export OPENCLAW_GATEWAY_BIND="${OPENCLAW_GATEWAY_BIND:-lan}" -export OPENCLAW_DISABLE_BONJOUR="${OPENCLAW_DISABLE_BONJOUR:-1}" +export OPENCLAW_DISABLE_BONJOUR="${OPENCLAW_DISABLE_BONJOUR:-}" export OPENCLAW_IMAGE="$IMAGE_NAME" export OPENCLAW_DOCKER_APT_PACKAGES="${OPENCLAW_DOCKER_APT_PACKAGES:-}" export OPENCLAW_EXTENSIONS="${OPENCLAW_EXTENSIONS:-}" @@ -529,9 +529,11 @@ echo "Docker setup pins Gateway mode to local." echo "Gateway runtime bind comes from OPENCLAW_GATEWAY_BIND (default: lan)." echo "Current runtime bind: $OPENCLAW_GATEWAY_BIND" if is_truthy_value "$OPENCLAW_DISABLE_BONJOUR"; then - echo "Bonjour/mDNS advertising: disabled for Docker bridge networking (OPENCLAW_DISABLE_BONJOUR=$OPENCLAW_DISABLE_BONJOUR)." + echo "Bonjour/mDNS advertising: force disabled (OPENCLAW_DISABLE_BONJOUR=$OPENCLAW_DISABLE_BONJOUR)." +elif [[ -z "$OPENCLAW_DISABLE_BONJOUR" ]]; then + echo "Bonjour/mDNS advertising: auto (disabled inside the Gateway container unless explicitly enabled)." else - echo "Bonjour/mDNS advertising: enabled (OPENCLAW_DISABLE_BONJOUR=$OPENCLAW_DISABLE_BONJOUR)." + echo "Bonjour/mDNS advertising: explicitly enabled (OPENCLAW_DISABLE_BONJOUR=$OPENCLAW_DISABLE_BONJOUR)." fi echo "Gateway token: $OPENCLAW_GATEWAY_TOKEN" echo "Tailscale exposure: Off (use host-level tailnet/Tailscale setup separately)." diff --git a/src/docker-setup.e2e.test.ts b/src/docker-setup.e2e.test.ts index c16e7ba206f..b17dfe0d744 100644 --- a/src/docker-setup.e2e.test.ts +++ b/src/docker-setup.e2e.test.ts @@ -231,7 +231,7 @@ describe("scripts/docker/setup.sh", () => { expect(envFile).toContain("OPENCLAW_DOCKER_APT_PACKAGES=ffmpeg build-essential"); expect(envFile).toContain("OPENCLAW_EXTRA_MOUNTS="); expect(envFile).toContain("OPENCLAW_HOME_VOLUME=openclaw-home"); // pragma: allowlist secret - expect(envFile).toContain("OPENCLAW_DISABLE_BONJOUR=1"); + expect(envFile).toContain("OPENCLAW_DISABLE_BONJOUR="); const extraCompose = await readFile( join(activeSandbox.rootDir, "docker-compose.extra.yml"), "utf8", @@ -556,10 +556,10 @@ describe("scripts/docker/setup.sh", () => { expect(compose).toContain('"gateway"'); }); - it("keeps docker-compose gateway Bonjour advertising disabled by default", async () => { + it("keeps docker-compose gateway Bonjour advertising in auto mode by default", async () => { const compose = await readFile(join(repoRoot, "docker-compose.yml"), "utf8"); expect( - compose.match(/OPENCLAW_DISABLE_BONJOUR: \$\{OPENCLAW_DISABLE_BONJOUR:-1\}/g), + compose.match(/OPENCLAW_DISABLE_BONJOUR: \$\{OPENCLAW_DISABLE_BONJOUR:-\}/g), ).toHaveLength(1); });