libpod: set search domain independently of nameservers
Set search domain irrespective of nameservers.
@@ -2010,18 +2010,18 @@ func (c *Container) generateResolvConf() error {
}
}
// If the user provided dns, it trumps all; then dns masq; then resolv.conf
- var search []string
keepHostServers := false
if len(nameservers) == 0 {
keepHostServers = true
// first add the nameservers from the networks status
nameservers = networkNameServers
- // when we add network dns server we also have to add the search domains
- search = networkSearchDomains
// slirp4netns has a built in DNS forwarder.
nameservers = c.addSlirp4netnsDNS(nameservers)
}
+ // Set DNS search domains
+ search := networkSearchDomains
+
if len(c.config.DNSSearch) > 0 || len(c.runtime.config.Containers.DNSSearches) > 0 {
customSearch := make([]string, 0, len(c.config.DNSSearch)+len(c.runtime.config.Containers.DNSSearches))
customSearch = append(customSearch, c.runtime.config.Containers.DNSSearches...)
