Skip to content

fix(shell): auto-repair DNS resolution at container startup#169

Open
konard wants to merge 3 commits intoProverCoderAI:mainfrom
konard:issue-168-c8c1e3f993ca
Open

fix(shell): auto-repair DNS resolution at container startup#169
konard wants to merge 3 commits intoProverCoderAI:mainfrom
konard:issue-168-c8c1e3f993ca

Conversation

@konard
Copy link
Contributor

@konard konard commented Mar 19, 2026

Summary

Docker's internal DNS resolver (127.0.0.11) intermittently loses its upstream nameservers, causing domain resolution to fail inside containers. This breaks git clone, package installs, and any network operations.

Fixes #168

Changes

  • DNS repair at startup (dns-repair.ts → entrypoint template): probes github.com via getent hosts at container boot; if resolution fails, appends fallback nameservers (8.8.8.8, 8.8.4.4, 1.1.1.1) to /etc/resolv.conf
  • Explicit DNS in docker-compose (docker-compose.ts template): adds dns: section to both main service and browser sidecar, ensuring containers always have working external DNS regardless of Docker daemon configuration
  • Example files updated: root docker-compose.yml and entrypoint.sh updated to match

Root cause

When Docker creates a container network, it configures 127.0.0.11 as the DNS resolver in /etc/resolv.conf. This internal resolver forwards queries to the host's DNS. However, on some hosts (especially when the Docker daemon is restarted or the network stack changes), the internal resolver loses its upstream configuration, leaving containers unable to resolve any external domains.

Математические гарантии

Инварианты:

  • ∀container: startup(container) → dns_healthy(container) ∨ dns_repaired(container)
  • ∀service ∈ compose: dns(service) = [8.8.8.8, 8.8.4.4, 1.1.1.1]

Предусловия:

  • Container has network access to at least one of the fallback DNS servers

Постусловия:

  • /etc/resolv.conf contains at least one working nameserver
  • getent hosts github.com succeeds (or warning is logged)

Сложность:

  • Время: O(1) per DNS probe attempt
  • Память: O(1) — appends at most 3 lines to resolv.conf

Test plan

  • pnpm --filter ./packages/lib typecheck passes
  • pnpm --filter ./packages/app check passes
  • pnpm --filter ./packages/lib test — all 86 tests pass
  • Manual: verify DNS repair works in a container with broken Docker DNS

🤖 Generated with Claude Code

konard and others added 2 commits March 19, 2026 08:38
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: ProverCoderAI#168
Docker's internal DNS resolver (127.0.0.11) intermittently loses its
upstream nameservers, breaking domain resolution inside containers.

- Add dns-repair step to entrypoint: probes github.com at startup,
  appends fallback nameservers (8.8.8.8, 8.8.4.4, 1.1.1.1) to
  /etc/resolv.conf when resolution fails
- Add explicit dns configuration to docker-compose template for both
  main service and browser sidecar
- Update example docker-compose.yml and entrypoint.sh

Fixes ProverCoderAI#168

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Сделать что бы в контейнере исправлялось интернет соедениение автоматически fix(shell): auto-repair DNS resolution at container startup Mar 19, 2026
@konard konard marked this pull request as ready for review March 19, 2026 08:45
@konard
Copy link
Contributor Author

konard commented Mar 19, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.739659
  • Calculated by Anthropic: $2.554058 USD
  • Difference: $-1.185602 (-31.70%)

🤖 Models used:

  • Tool: Claude
  • Requested: opus
  • Main model: Claude Opus 4.6 (ID: claude-opus-4-6, Anthropic, cutoff: 2025-05)
    📎 Log file uploaded as Gist (1351KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Mar 19, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@skulidropek
Copy link
Contributor

покрой код тестами

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.

Сделать что бы в контейнере исправлялось интернет соедениение автоматически

2 participants