Skip to content

fix(peon-ping): auto-patch host.docker.internal on native Linux Docker - #86

Merged
baxyz merged 2 commits into
mainfrom
peon-ping-auto-patch-hosts
Sep 8, 2026
Merged

baxyz merged 2 commits into
mainfrom
peon-ping-auto-patch-hosts

Conversation

@baxyz

@baxyz baxyz commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 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.
  • Adds a postStartCommand (patch-hosts.sh) that derives the same IP that runArgs flag would have resolved to — the container's own default gateway, read from /proc/net/route (no iproute2 dependency 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/hosts exists in this feature).
  • Idempotent and best-effort: no-ops once it already resolves (including on Docker Desktop), falls back to sudo if a direct write is denied, only warns (never fails) if neither works — the manual runArgs fallback stays documented for that edge case.
  • Verified locally: parsed gateway IP matches ip route's own output exactly (172.17.0.1 in this sandbox), the script no-ops correctly on a second run, and the sudo fallback path was exercised directly.
  • Patch bump (1.2.21.2.3), not minor: no new capability for anyone who'd already added the runArgs workaround — this just removes the need for that step.
  • Path double-checked against dotfiles-sync's identical, already-shipped pattern: install.sh copies to /usr/local/share/peon-ping/patch-hosts.sh, the manifest's postStartCommand points 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 -n syntax checks, JSON validated
  • Manual local verification of patch-hosts.sh (gateway parsing, idempotency, sudo fallback)
  • Added test 8/9 to test/peon-ping/test.sh (script installed; host.docker.internal resolves, as a WARN not a hard FAIL since it's unconfirmed whether the test harness triggers postStartCommand before test.sh runs)
  • CI green (39/40, then 40/40 after the version-fix push)

🤖 Generated with Claude Code

…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>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

✅ PR Validation Passed

All checks passed!


📋 Pipeline Status

Job Status
🧾 Conventional Commits passing
🔖 Version Bump passing
🧪 Feature Tests passing
🐚 ShellCheck passing

🤖 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>
@baxyz baxyz changed the title feat(peon-ping): auto-patch host.docker.internal on native Linux Docker fix(peon-ping): auto-patch host.docker.internal on native Linux Docker Sep 8, 2026
@baxyz
baxyz merged commit 704b388 into main Sep 8, 2026
39 checks passed
@baxyz
baxyz deleted the peon-ping-auto-patch-hosts branch September 8, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant