mirror of
https://github.com/apple/container.git
synced 2026-07-12 20:47:04 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user