Browse Source

Only override service mac if set on the main network.

Signed-off-by: Florian Apolloner <[email protected]>
Florian Apolloner 1 year ago
parent
commit
2ebb475433
1 changed files with 1 additions and 1 deletions
  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)
 		}
 
-		if mainNw != nil {
+		if mainNw != nil && mainNw.MacAddress != "" {
 			macAddress = mainNw.MacAddress
 		}
 	}