diff --git a/libnetwork/internal/resolvconf/resolvconf.go b/libnetwork/internal/resolvconf/resolvconf.go index 5e9278c48a..c418492324 100644 --- a/libnetwork/internal/resolvconf/resolvconf.go +++ b/libnetwork/internal/resolvconf/resolvconf.go @@ -480,10 +480,8 @@ func (rc *ResolvConf) processLine(line string) { if len(fields) < 2 { return } - // Replace options from earlier directives. - // TODO(robmry) - preserving incorrect behaviour, options should accumulate. - // rc.options = append(rc.options, fields[1:]...) - rc.options = fields[1:] + // Accumulate options. + rc.options = append(rc.options, fields[1:]...) default: // Copy anything that's not a recognised directive. rc.other = append(rc.other, line) diff --git a/libnetwork/resolvconf/resolvconf_unix_test.go b/libnetwork/resolvconf/resolvconf_unix_test.go index 86ccbf4106..6d3492d10b 100644 --- a/libnetwork/resolvconf/resolvconf_unix_test.go +++ b/libnetwork/resolvconf/resolvconf_unix_test.go @@ -263,7 +263,7 @@ options opt1 opt2 opt3`, input: `nameserver 1.2.3.4 options opt1 opt2 options opt3 opt4`, - result: []string{"opt3", "opt4"}, + result: []string{"opt1", "opt2", "opt3", "opt4"}, }, } { test := GetOptions([]byte(tc.input))