From 443f56efb008ea45a0c6c5741d1b67546d0ae9df Mon Sep 17 00:00:00 2001 From: Rob Murray Date: Mon, 12 Feb 2024 19:57:46 +0000 Subject: [PATCH] Set up DNS names for Windows default network DNS names were only set up for user-defined networks. On Linux, none of the built-in networks (bridge/host/none) have built-in DNS, so they don't need DNS names. But, on Windows, the default network is "nat" and it does need the DNS names. Signed-off-by: Rob Murray --- daemon/container_operations.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/daemon/container_operations.go b/daemon/container_operations.go index e5bf1eb87d..78b1c98a19 100644 --- a/daemon/container_operations.go +++ b/daemon/container_operations.go @@ -649,7 +649,10 @@ func cleanOperationalData(es *network.EndpointSettings) { } func (daemon *Daemon) updateNetworkConfig(container *container.Container, n *libnetwork.Network, endpointConfig *networktypes.EndpointSettings, updateSettings bool) error { - if containertypes.NetworkMode(n.Name()).IsUserDefined() { + // Set up DNS names for a user defined network, and for the default 'nat' + // network on Windows (IsBridge() returns true for nat). + if containertypes.NetworkMode(n.Name()).IsUserDefined() || + (serviceDiscoveryOnDefaultNetwork() && containertypes.NetworkMode(n.Name()).IsBridge()) { endpointConfig.DNSNames = buildEndpointDNSNames(container, endpointConfig.Aliases) }