Skip to content

Commit

Permalink
Add checkLoopbackOpts. Fix #38512
Browse files Browse the repository at this point in the history
Control param checkLoopback depending on sb.config.dnsList
* if dnsList contains 127.0.0.1 - HostLoopback will be set to false. Container net namespace will be used to access loopback dns .

Fix to moby/moby#38512

Signed-off-by: Siarhei Rasiukevich <raskintech@gmail.com>
  • Loading branch information
Siarhei Rasiukevich authored and Siarhei Rasiukevich committed Feb 13, 2019
1 parent 19f814d commit b85baba
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sandbox_dns_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,16 @@ func (sb *sandbox) setupDNS() error {
logrus.Infof("/etc/resolv.conf does not exist")
}

if len(sb.config.dnsList) > 0 || len(sb.config.dnsSearchList) > 0 || len(sb.config.dnsOptionsList) > 0 {
checkLoopbackOpts := func() bool {
for _, n := range sb.config.dnsList {
if n == "127.0.0.1" {
return true
}
}
return false
}

if checkLoopbackOpts() {
var (
err error
dnsList = resolvconf.GetNameservers(currRC.Content, types.IP)
Expand Down

0 comments on commit b85baba

Please sign in to comment.