fix(peon-ping): auto-patch host.docker.internal on native Linux Docker - #86
Merged
Merged
Conversation
…cker host.docker.internal doesn't resolve out of the box on native Linux Docker (only Docker Desktop injects that DNS entry automatically), which broke the audio relay unless the user manually added runArgs: ["--add-host=host.docker.internal:host-gateway"] to their own devcontainer.json — a Feature can't set runArgs itself, it's only read from the consumer's top-level config. Adds a postStartCommand (patch-hosts.sh) that derives the same IP the container would resolve from that runArgs flag — its own default gateway, read from /proc/net/route rather than depending on the iproute2 package — and writes it directly into the container's own /etc/hosts. Idempotent and best-effort: a no-op once it resolves (including on Docker Desktop, where it already does), only warns if /etc/hosts isn't writable and sudo isn't available either, in which case the manual runArgs fallback still works and stays documented. Verified locally: parsed gateway IP matches `ip route`'s own default-gateway output exactly, the script correctly no-ops on a second run once the entry exists, and falls back to sudo when a direct write is denied. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ PR Validation Passed
📋 Pipeline Status
🤖 Generated by @helpers4 CI • 2026-09-08 |
…ady worked around this 1.3.0 implied a new capability. It isn't one: the audio relay already worked for anyone who'd added the runArgs line themselves — this just removes that manual step. Patch-level, matching what it actually is: 1.2.2 -> 1.2.3. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
host.docker.internaldoesn't resolve out of the box on native Linux Docker (only Docker Desktop injects that DNS entry automatically), which broke the audio relay unless the user manually addedrunArgs: ["--add-host=host.docker.internal:host-gateway"]to their owndevcontainer.json— a Feature can't setrunArgsitself.postStartCommand(patch-hosts.sh) that derives the same IP thatrunArgsflag would have resolved to — the container's own default gateway, read from/proc/net/route(noiproute2dependency needed) — and writes it directly into the container's/etc/hosts, entirely inside the container's own filesystem namespace (confirmed: no host-side file is touched, no bind-mount of the host's/etc/hostsexists in this feature).sudoif a direct write is denied, only warns (never fails) if neither works — the manualrunArgsfallback stays documented for that edge case.ip route's own output exactly (172.17.0.1in this sandbox), the script no-ops correctly on a second run, and the sudo fallback path was exercised directly.1.2.2→1.2.3), not minor: no new capability for anyone who'd already added therunArgsworkaround — this just removes the need for that step.dotfiles-sync's identical, already-shipped pattern:install.shcopies to/usr/local/share/peon-ping/patch-hosts.sh, the manifest'spostStartCommandpoints at that exact same path.Board card: "Replace peon-ping's runArgs host.docker.internal fix with postCreateCommand pattern" (Backlog). The related card "Verify peon-ping host relay is actually reachable" needs real hardware to test and is out of scope here.
Test plan
bash -nsyntax checks, JSON validatedpatch-hosts.sh(gateway parsing, idempotency, sudo fallback)test/peon-ping/test.sh(script installed;host.docker.internalresolves, as a WARN not a hard FAIL since it's unconfirmed whether the test harness triggerspostStartCommandbeforetest.shruns)🤖 Generated with Claude Code