Skip to content

External DNS forwarding is broken on Windows container NAT networks #46792

@MikeZappa87

Description

@MikeZappa87

Description

A 'feature' was implemented back in 2016 that sets the default gateway as the primary DNS server for Windows containers. This is currently a bool 'DisableGatewayDNS' and the issue is that no DNS servers are at the address thus resulting in the primary failing and then making use of the secondary DNS server. This being the default behavior causes issues if the user does not have a DNS server listening on the node itself.

Link to DisableGatewayDNS property: https://github.com/moby/moby/blob/7e66d9900c81e872e5ecc89aa0bb03e52901447f/libnetwork/drivers/windows/windows.go#L49C2-L49C19

Original Commit:
5a5b7fe

We have several options here and I am willing to do the work to resolve this.

  1. Remove the feature entirely
  2. Change the name of property to EnableGatewayDNS
  3. If the option is not set, default to true
  4. Fix issue with DNS

For option 3:

func (ncfg *networkConfiguration) UnmarshalJSON(b []byte) error {

The user still has the ability to set custom DNS servers via the "com.docker.network.windowsshim.dnsservers" option as a comma separated string on network creation or by using the --dns flag on docker run. Note that when using these options, the default gateway is still used as the primary however the fail behavior goes to the additional DNS servers.

Issues:
https://forums.docker.com/t/dns-broken-on-docker-desktop-for-windows/130121
microsoft/Windows-Containers#216

More issues exist. It does seem that most people are setting "com.docker.network.windowsshim.disable_gatewaydns=true" as the default behavior of false is not applicable to 99% of users.

In this comment, I propose a work around:
microsoft/Windows-Containers#216 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions