6c68be24a2
Make the internal DNS resolver for Windows containers forward requests to upsteam DNS servers when it cannot respond itself, rather than returning SERVFAIL. Windows containers are normally configured with the internal resolver first for service discovery (container name lookup), then external resolvers from '--dns' or the host's networking configuration. When a tool like ping gets a SERVFAIL from the internal resolver, it tries the other nameservers. But, nslookup does not, and with this change it does not need to. The internal resolver learns external server addresses from the container's HNSEndpoint configuration, so it will use the same DNS servers as processes in the container. The internal resolver for Windows containers listens on the network's gateway address, and each container may have a different set of external DNS servers. So, the resolver uses the source address of the DNS request to select external resolvers. On Windows, daemon.json feature option 'windows-no-dns-proxy' can be used to prevent the internal resolver from forwarding requests (restoring the old behaviour). Signed-off-by: Rob Murray <rob.murray@docker.com>
34 lines
667 B
Go
34 lines
667 B
Go
//go:build !windows
|
|
|
|
package libnetwork
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/docker/docker/libnetwork/ipamapi"
|
|
)
|
|
|
|
type platformNetwork struct{} //nolint:nolintlint,unused // only populated on windows
|
|
|
|
// Stub implementations for DNS related functions
|
|
|
|
func (n *Network) startResolver() {
|
|
}
|
|
|
|
func addEpToResolver(
|
|
ctx context.Context,
|
|
netName, epName string,
|
|
config *containerConfig,
|
|
epIface *EndpointInterface,
|
|
resolvers []*Resolver,
|
|
) error {
|
|
return nil
|
|
}
|
|
|
|
func deleteEpFromResolver(epName string, epIface *EndpointInterface, resolvers []*Resolver) error {
|
|
return nil
|
|
}
|
|
|
|
func defaultIpamForNetworkType(networkType string) string {
|
|
return ipamapi.DefaultIPAM
|
|
}
|