daemon: endpoints on default nw aren't anonymous

They just happen to exist on a network that doesn't support DNS-based
service discovery (ie. no embedded DNS servers are started for them).

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton 2023-11-04 12:22:40 +01:00
parent 74cf9a0f60
commit 1eb0751803
No known key found for this signature in database
GPG key ID: 630B8E1DCBDB1864

View file

@ -793,8 +793,7 @@ func buildCreateEndpointOptions(c *container.Container, n *libnetwork.Network, e
var genericOptions = make(options.Generic)
nwName := n.Name()
defaultNetName := runconfig.DefaultDaemonNetworkMode().NetworkName()
if c.NetworkSettings.IsAnonymousEndpoint || (nwName == defaultNetName && !serviceDiscoveryOnDefaultNetwork()) {
if c.NetworkSettings.IsAnonymousEndpoint {
createOptions = append(createOptions, libnetwork.CreateOptionAnonymous())
}