Skip to content

Hermetic containers stall on DNS timeouts instead of failing fast #9633

Closed

Description

@Kump3r

Summary

When a task runs with hermetic: true, Concourse blocks outbound traffic via iptables DROP rules. However, the container still gets a fully populated /etc/resolv.conf. Any process that performs a DNS lookup will send UDP packets that silently hit the DROP rules and wait for the full resolver timeout (typically 5 seconds per attempt × retries × number of nameservers) before the lookup fails.

Root cause:
SetupMounts in worker/runtime/cni_network.go always writes a populated resolv.conf regardless of hermeticity. DropContainerTraffic adds the DROP rules only after the container is already configured with nameservers to query.

Steps to Reproduce

  1. docker compose up (with containerd) runtime
  2. Create the following pipeline:
jobs:
  - name: hermetic-dns-timeout
    plan:
      - task: dns-lookup
        hermetic: true
        config:
          platform: linux
          image_resource:
            type: registry-image
            source:
              repository: alpine
          run:
            path: sh
            args:
              - -c
              - |
                echo "Starting DNS lookup..."
                time nslookup google.com
                echo "Done."
  1. Trigger the job and observe how long nslookup example.com takes to return

Expected Results

DNS lookups in a hermetic container should fail immediately. Since all outbound traffic is intentionally blocked, there is no point sending DNS packets at all.

Actual Results

Tools that do DNS lookups at startup (e.g. package managers, SDKs, manifest validators) can take 30–40 minutes to begin actual work, spending all that time exhausting DNS retry cycles against a silent firewall.

Web Node(s) configuration

No response

Worker(s) configuration

CONCOURSE_RUNTIME: containerd

Concourse Version

v8.2.4

Browser (if applicable)

No response

Did this use to work?

no

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions