Don't bake DNS server into builder container config. (#1370)

- Closes #656.
- The SandboxService automatically sets the DNS server as part of
bootstrap if no server is given. Setting it in the container config
means that the builder will fail if the system restarts and the network
subnet changes.
This commit is contained in:
J Logan authored and GitHub committed 2026-03-30 17:22:10 -07:00
1 parent c501c8780b
commit 490cb69cc6
1 file changed
+2 -5
@@ -267,17 +267,14 @@ extension Application {
guard let defaultNetwork = try await ClientNetwork.builtin else {
throw ContainerizationError(.invalidState, message: "default network is not present")
}
guard case .running(_, let networkStatus) = defaultNetwork else {
guard case .running(_, _) = defaultNetwork else {
throw ContainerizationError(.invalidState, message: "default network is not running")
}
config.networks = [
AttachmentConfiguration(network: defaultNetwork.id, options: AttachmentOptions(hostname: Builder.builderContainerId))
]
let subnet = networkStatus.ipv4Subnet
let nameserver = IPv4Address(subnet.lower.value + 1).description
let nameservers = dnsNameservers.isEmpty ? [nameserver] : dnsNameservers
config.dns = ContainerConfiguration.DNSConfiguration(
nameservers: nameservers,
nameservers: dnsNameservers,
domain: dnsDomain,
searchDomains: dnsSearchDomains,
options: dnsOptions