Skip to content

Commit

Permalink
Set up DNS names for Windows default network
Browse files Browse the repository at this point in the history
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 <rob.murray@docker.com>
(cherry picked from commit 443f56e)
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
  • Loading branch information
robmry authored and akerouanton committed Mar 1, 2024
1 parent 00b2e10 commit d66e0fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion daemon/container_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit d66e0fb

Please sign in to comment.