Only override service mac if set on the main network.

Signed-off-by: Florian Apolloner <florian@apolloner.eu>
This commit is contained in:
Florian Apolloner 2025-01-07 10:30:15 +01:00 committed by Nicolas De loof
parent d474515d45
commit 2ebb475433

View File

@ -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
}
}