Skip to content

Fix Alpine DNS issues by falling back to host nameservers#1042

Closed
Ronitsabhaya75 wants to merge 1 commit intoapple:mainfrom
Ronitsabhaya75:fix-alpine-dns-1033
Closed

Fix Alpine DNS issues by falling back to host nameservers#1042
Ronitsabhaya75 wants to merge 1 commit intoapple:mainfrom
Ronitsabhaya75:fix-alpine-dns-1033

Conversation

@Ronitsabhaya75
Copy link
Copy Markdown
Contributor

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Resolves #1033.

Alpine Linux containers (using musl libc) often encounter transient DNS errors ("DNS: transient error (try again later)") during builds, particularly when running apk update.

This change modifies SandboxService to explicitly read nameservers from the host's /etc/resolv.conf and append them to the container's DNS configuration as a fallback.

    private func getDefaultNameservers(attachmentConfigurations: [AttachmentConfiguration]) async throws -> [String] {
        var nameservers: [String] = []

        for attachmentConfiguration in attachmentConfigurations {

            nameservers.append(status.ipv4Gateway.description)
            break
        }

        let systemNameservers = self.getSystemNameservers()
        for ns in systemNameservers {
            if !nameservers.contains(ns) {
                nameservers.append(ns)
            }
        }
        return nameservers
    }

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@Ronitsabhaya75 Ronitsabhaya75 deleted the fix-alpine-dns-1033 branch March 27, 2026 14:43
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.

[Bug]: container build fails to connect to Alpine with DNS: transient error (try again later)

2 participants