File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -487,20 +487,12 @@ func (m *manager) getNetworkNames(containerNames []string) ([]string, error) {
487487 if err != nil {
488488 return nil , err
489489 }
490-
491- // Count currently attached containerNames
492- attachedContainerNames := 0
493-
494- for _ , container := range containerNames {
495- if containerInNetworks (container , attached ) {
496- attachedContainerNames = attachedContainerNames + 1
497- }
498- }
499-
500- // If more than 0 containers in a network (excluding containers from config)
501- if (len (attached .Containers ) - attachedContainerNames ) > 0 {
502- if (network .Attachable || network .Scope == "local" ) && ! containsString (ignoredNetworkNames , network .Name ) {
490+ for _ , endpoint := range attached .Containers {
491+ if ! containsString (containerNames , endpoint .Name ) &&
492+ (network .Attachable || network .Scope == "local" ) &&
493+ ! containsString (ignoredNetworkNames , network .Name ) {
503494 names = append (names , network .Name )
495+ break
504496 }
505497 }
506498 }
You can’t perform that action at this time.
0 commit comments