Default to "windows-dns-proxy":true

In 26.1, we added daemon feature flag "windows-dns-proxy" which could
be set to "true" to make "nslookup" work in Windows containers, by
forwarding requests from the internal resolver to the container's
external DNS servers.

This changes the default to forwarding-enabled - it can be disabled by
via daemon.json using ...
  "features": { "windows-dns-proxy": false }

Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
Rob Murray
2024-05-13 11:11:20 +01:00
parent cd08d377c5
commit 33f9a5329a
2 changed files with 6 additions and 9 deletions

View File

@@ -164,10 +164,10 @@ func serviceDiscoveryOnDefaultNetwork() bool {
}
func buildSandboxPlatformOptions(container *container.Container, cfg *config.Config, sboxOptions *[]libnetwork.SandboxOption) error {
// By default, the Windows internal resolver does not forward requests to
// external resolvers - but forwarding can be enabled using feature flag
// "windows-dns-proxy":true.
if doproxy, exists := cfg.Features["windows-dns-proxy"]; !exists || !doproxy {
// By default, the Windows internal resolver forwards requests to external
// resolvers - but forwarding can be disabled using feature flag
// "windows-dns-proxy":false.
if doproxy, exists := cfg.Features["windows-dns-proxy"]; exists && !doproxy {
*sboxOptions = append(*sboxOptions, libnetwork.OptionDNSNoProxy())
}
return nil

View File

@@ -150,10 +150,7 @@ func TestNslookupWindows(t *testing.T) {
defer c.ContainerRemove(ctx, res.ContainerID, containertypes.RemoveOptions{Force: true})
assert.Check(t, is.Equal(res.ExitCode, 0))
// Current default is to not-forward requests to external servers, which
// Current default is to forward requests to external servers, which
// can only be changed in daemon.json using feature flag "windows-dns-proxy".
// So, expect the lookup to fail...
assert.Check(t, is.Contains(res.Stderr.String(), "Server failed"))
// When the default behaviour is changed, nslookup should succeed...
//assert.Check(t, is.Contains(res.Stdout.String(), "Addresses:"))
assert.Check(t, is.Contains(res.Stdout.String(), "Addresses:"))
}