Skip to content

[Feature] Propagate host.docker.internal DNS to spawned containers #422

Closed

Description

@Mossaka

Background

PR #210 proposed configuring Docker's /etc/hosts when --enable-host-access is used, so spawned containers can resolve host.docker.internal.

Problem

When --enable-host-access is used, spawned containers via docker-wrapper need host.docker.internal DNS resolution.

Proposed Changes

  1. Pass AWF_ENABLE_HOST_ACCESS environment variable to agent container
  2. Modify docker-wrapper.sh to:
    • Allow --add-host host.docker.internal:host-gateway specifically when AWF_ENABLE_HOST_ACCESS=true
    • Inject --add-host host.docker.internal:host-gateway to spawned containers when enabled
  3. Security fix: Make AWF_ENABLE_HOST_ACCESS readonly in entrypoint.sh to prevent malicious code from tampering with the variable

Security Note

The environment variable should be declared readonly in entrypoint.sh, preventing malicious code from enabling host access when it wasn't authorized.


Issue created from PR #210 during backlog cleanup

Activity

  1. github-actions commented on Jan 26, 2026

    @github-actions
    Contributor

    🍪 Issue Monster has assigned this to Copilot!

    I've identified this issue as a good candidate for automated resolution and assigned it to the Copilot agent.

    The Copilot agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    AI generated by Issue Monster

  2. github-actions commented on Feb 5, 2026

    @github-actions
    Contributor

    🍪 Issue Monster has assigned this to Copilot!

    I've identified this issue as a good candidate for automated resolution and assigned it to the Copilot agent.

    The Copilot agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    AI generated by Issue Monster

  3. gh-antoine-brechon commented on Mar 30, 2026

    @gh-antoine-brechon

    Hi @Mossaka thanks for the great work! upvoting this issue. We are currently trying the agentic workflows running on dedicated self-hosted runners with mandatory corporate DNS servers. This breaks the current implementation as squid hardcodes google's DNS in its squid.conf which makes the agentic workflows unusable for us in a DNS restricted environment.

    From copilot debug session

    Now I have a clear picture. The root cause is confirmed:
    
      The Squid proxy in the AWF container is hardcoded to use Google DNS (`dns_nameservers 8.8.8.8 8.8.4.4`), but the runner is in a private VPC where:
      1. The runner's own DNS resolver (via the AWS VPC DNS at `X.X.X.X` or similar) can resolve `api.githubcopilot.com` successfully
      2. But Google's DNS (8.8.8.8/8.8.4.4) is blocked or inaccessible from within the VPC, causing `ERR_DNS_FAIL` with "No DNS records"
    
      3. The "No DNS records" error from Squid indicates the DNS server itself is unreachable or timing out, not that the domain doesn't exist
    
      This is a known limitation when running AWF with self-hosted runners in private networks. The real fix needs to come from the gh-aw side—the AWF should delegate to the host's DNS resolver instead of forcing Google's public DNS.
    

    squid logs

    </head><body id="ERR_DNS_FAIL">
    <div id="titles">
    <h1>ERROR</h1>
    <h2>The requested URL could not be retrieved</h2>
    </div>
    <hr>
    
    <div id="content">
    <p>The following error was encountered while trying to retrieve the URL: <a href="https://api.githubcopilot.com/*">https://api.githubcopilot.com/*</a></p>
    
    <blockquote id="error">
    <p><b>Unable to determine IP address from host name <q>api.githubcopilot.com</q></b></p>
    </blockquote>
    
    <p>The DNS server returned:</p>
    <blockquote id="data">
    <pre>No DNS records</pre>
    </blockquote>

    extract from squid.conf

    # Disable caching
    cache deny all
    
    # DNS settings - Squid resolves all domains for HTTP/HTTPS traffic
    dns_nameservers 8.8.8.8 8.8.4.4
    
    # Forwarded headers
    forwarded_for delete
    via off
    
    
    
  4. gh-antoine-brechon commented on Mar 31, 2026

    @gh-antoine-brechon

    Hi @Mossaka circling back here, are you able to provide an ETA for this feature as it is a roadblocker for enterprise usage within restricted environments? Thanks!

  5. Mossaka commented on Mar 31, 2026

    @Mossaka
    ContributorAuthor

    Hi @github-antoine-brechon , yeah this is a slightly different issue. You are right that the default of Google DNS breaks enterprise environments out of the box. I will be working on to fix it.

    FWIW, awf already supports --dns-servers flag, which you can run awf --dns-servers 10.0.0.2 to solve your problem at the awf level. But gh-aw doesn't pass --dns-servers to awf and there's no workflow frontmatter field for it.

  6. Mossaka commented on Apr 6, 2026

    @Mossaka
    ContributorAuthor

    closing this issue as the agent container cannot spawn containers.

  7. Mossaka commented on Apr 6, 2026

    @Mossaka
    ContributorAuthor

    The child container propagation part of this issue depends on Docker-in-Docker, which is being fully removed (#1727). Without DinD, there are no child containers to propagate host.docker.internal to.

    The readonly AWF_ENABLE_HOST_ACCESS hardening is still valuable — extracting to a separate issue.

    Also found a real bug while working on this: docker-manager.ts sets AWF_ENABLE_HOST_ACCESS = 'true' in the allowHostServicePorts safety net, but entrypoint.sh and setup-iptables.sh check for = "1". This means the safety net silently fails. Filing a separate bug fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions