Skip to content

Commit

Permalink
Fix ndots configuration
Browse files Browse the repository at this point in the history
When ndots was being explicitely passed in the daemon conf
the configuration landing into the container was corrupted
e.g. options ndots:1 ndots:0
The fix just removes the user option so that is not replicated

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
  • Loading branch information
Flavio Crisciani committed Oct 20, 2017
1 parent 52a9ab5 commit 2c75c71
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sandbox_dns_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (sb *sandbox) rebuildDNS() error {
dnsOpt:
for _, resOpt := range resOptions {
if strings.Contains(resOpt, "ndots") {
for _, option := range dnsOptionsList {
for i, option := range dnsOptionsList {
if strings.Contains(option, "ndots") {
parts := strings.Split(option, ":")
if len(parts) != 2 {
Expand All @@ -371,7 +371,10 @@ dnsOpt:
if num, err := strconv.Atoi(parts[1]); err != nil {
return fmt.Errorf("invalid number for ndots option %v", option)
} else if num > 0 {
// if the user sets ndots, we mark it as set but we remove the option to guarantee
// that into the container land only ndots:0
sb.ndotsSet = true
dnsOptionsList = append(dnsOptionsList[:i], dnsOptionsList[i+1:]...)
break dnsOpt
}
}
Expand Down

0 comments on commit 2c75c71

Please sign in to comment.