فهرست منبع

libnetwork: sandbox.rebuildDNS() make updating sandbox more atomic

Don't update external resolvers until after we successfully parsed all options.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 سال پیش
والد
کامیت
0ef0dab2f7
1فایلهای تغییر یافته به همراه3 افزوده شده و 4 حذف شده
  1. 3 4
      libnetwork/sandbox_dns_unix.go

+ 3 - 4
libnetwork/sandbox_dns_unix.go

@@ -365,10 +365,6 @@ func (sb *sandbox) rebuildDNS() error {
 		return err
 	}
 
-	if len(sb.extDNS) == 0 {
-		sb.setExternalResolvers(currRC, resolvconf.IPv4, false)
-	}
-
 	// If the user config and embedded DNS server both have ndots option set,
 	// remember the user's config so that unqualified names not in the docker
 	// domain can be dropped.
@@ -403,6 +399,9 @@ dnsOpt:
 		// Ref: https://linux.die.net/man/5/resolv.conf
 		dnsOptionsList = append(dnsOptionsList, resOptions...)
 	}
+	if len(sb.extDNS) == 0 {
+		sb.setExternalResolvers(currRC, resolvconf.IPv4, false)
+	}
 
 	var (
 		// external v6 DNS servers have to be listed in resolv.conf