From e2c44c3d4958947f2b5331f240bfb163e798bf24 Mon Sep 17 00:00:00 2001 From: Aditya R Date: Sun, 20 Nov 2022 07:33:37 +0530 Subject: [PATCH] libpod: set search domain independently of nameservers Set search domain irrespective of nameservers. Signed-off-by: Aditya R --- libpod/container_internal_common.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libpod/container_internal_common.go b/libpod/container_internal_common.go index 9e93188fd3..b26b4c95cc 100644 --- a/libpod/container_internal_common.go +++ b/libpod/container_internal_common.go @@ -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...)