Ver Fonte

Only override service mac if set on the main network.

Signed-off-by: Florian Apolloner <[email protected]>
Florian Apolloner há 1 ano atrás
pai
commit
2ebb475433
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      pkg/compose/create.go

+ 1 - 1
pkg/compose/create.go

@@ -416,7 +416,7 @@ func (s *composeService) prepareContainerMACAddress(ctx context.Context, service
 			return "", fmt.Errorf("a MAC address is specified for multiple networks (%s), but this feature requires Docker Engine 1.44 or later (currently: %s)", strings.Join(withMacAddress, ", "), version)
 			return "", fmt.Errorf("a MAC address is specified for multiple networks (%s), but this feature requires Docker Engine 1.44 or later (currently: %s)", strings.Join(withMacAddress, ", "), version)
 		}
 		}
 
 
-		if mainNw != nil {
+		if mainNw != nil && mainNw.MacAddress != "" {
 			macAddress = mainNw.MacAddress
 			macAddress = mainNw.MacAddress
 		}
 		}
 	}
 	}