fix: mount /etc/hosts in chroot mode for localhost resolution#545
fix: mount /etc/hosts in chroot mode for localhost resolution#545
Conversation
In chroot mode with selective /etc mounts, /etc/hosts was not mounted, causing tools like JSDOM/Vitest to fail with "getaddrinfo EAI_AGAIN localhost". Add a read-only bind mount of /etc/hosts into the chroot so hostname resolution works correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Chroot tests failed Smoke Chroot failed - See logs for details. |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
✅ Coverage Check PassedOverall Coverage
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in chroot mode where /etc/hosts was not mounted, causing DNS resolution failures for localhost in tools like JSDOM and Vitest. The fix adds a read-only bind mount of /etc/hosts to the selective /etc mounts already in place for chroot mode.
Changes:
- Add
/etc/hosts:/host/etc/hosts:romount to chroot mode configuration in docker-manager.ts - Add corresponding test assertion to verify the mount is configured correctly
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/docker-manager.ts | Adds /etc/hosts to the list of selective /etc mounts for chroot mode with appropriate inline comment |
| src/docker-manager.test.ts | Adds test assertion to verify /etc/hosts is included in volumes when chroot mode is enabled |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Build Test: Node.js - Results
Overall: ✅ PASS All Node.js test projects successfully installed dependencies and passed their test suites.
|
Deno Build Test Results
Overall: ✅ PASS All Deno tests completed successfully.
|
Smoke Test: Claude ✅Last 2 merged PRs:
✅ GitHub MCP Status: PASS
|
|
Smoke Test Results 🚀 Last 2 merged PRs:
✅ GitHub MCP: Working (via list_pull_requests) Overall: PASS ✅ cc: @Mossaka
|
Go Build Test Results
Overall: PASS ✅ All Go projects successfully downloaded dependencies and passed their tests.
|
C++ Build Test Results
Overall: PASS ✅ All C++ projects built successfully.
|
Build Test: Java - FAILED ❌Status: ENVIRONMENT ERROR Unable to execute Java build tests due to broken Java runtime environment in GitHub Actions runner. Error DetailsThe Java binary in the runner environment is corrupted or misconfigured:
Test Results
Overall: FAIL - Environment Issue Reproduction$ java -version
GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)This test cannot proceed until the Java runtime is fixed in the runner environment.
|
Build Test: Bun - FAILED ❌Environment Issue: Bun runtime cannot function in this containerized environment. Results
Overall: FAIL Error DetailsBun installation succeeded, but Root Cause: Bun requires Required Action: This test needs to run in an environment with full
|
Build Test: Rust - Environment IssueStatus: FAILED ❌ SummaryUnable to execute Rust build and test workflow due to environment configuration issue. Details
Technical DetailsAll attempts to execute Rust tooling result in bash version output instead of the expected tool output: $ /home/runner/.cargo/bin/cargo build
# Expected: Cargo build output
# Actual: GNU bash, version 5.2.21(1)-release...
$ /home/runner/.cargo/bin/rustup --version
# Expected: rustup version
# Actual: GNU bash, version 5.2.21(1)-release...This suggests a fundamental issue with how the bash execution environment is passing arguments to Rust binaries in the GitHub Actions runner. Investigation Attempted
Required ActionThis requires investigation into:
Cannot complete build/test validation for
|
Summary
/etcmounts,/etc/hostswas not mounted, causing tools like JSDOM/Vitest to fail withgetaddrinfo EAI_AGAIN localhost/etc/hostsinto the chroot (/etc/hosts:/host/etc/hosts:ro)/hostis the real host root filesystem, a read-only bind mount is the safest approach — no mutation, no cleanup neededTest plan
npm run buildcompilesnpm test— 728 unit tests pass (including new assertion)npm run lint— no errorsgetent hosts localhostresolves inside chroot🤖 Generated with Claude Code