daemon: buildCreateEndpointOptions: skip getPortMapInfo() if not needed
`getPortMapInfo` does many things; it creates a copy of all the sandbox endpoints, gets the driver, endpoints, and network from store, and creates port-bindings for all exposed and mapped ports. We should look if we can create a more minimal implementation for this purpose, but in the meantime, let's prevent it being called if we don't need it by making it the second condition in the check. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
9e9a17950a
commit
6ce92aa523
1 changed files with 4 additions and 3 deletions
|
@ -893,9 +893,10 @@ func buildCreateEndpointOptions(c *container.Container, n *libnetwork.Network, e
|
|||
}
|
||||
}
|
||||
|
||||
// Port-mapping rules belong to the container & applicable only to non-internal networks
|
||||
portmaps := getPortMapInfo(sb)
|
||||
if n.Info().Internal() || len(portmaps) > 0 {
|
||||
// Port-mapping rules belong to the container & applicable only to non-internal networks.
|
||||
//
|
||||
// TODO(thaJeztah): Look if we can provide a more minimal function for getPortMapInfo, as it does a lot, and we only need the "length".
|
||||
if n.Info().Internal() || len(getPortMapInfo(sb)) > 0 {
|
||||
return createOptions, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue