diff --git a/daemon/container_operations.go b/daemon/container_operations.go index 2c5e04888e..74d1c3ccdf 100644 --- a/daemon/container_operations.go +++ b/daemon/container_operations.go @@ -612,6 +612,13 @@ func validateEndpointSettings(nw *libnetwork.Network, nwName string, epConfig *n } } + if epConfig.MacAddress != "" { + _, err := net.ParseMAC(epConfig.MacAddress) + if err != nil { + return fmt.Errorf("invalid MAC address %s", epConfig.MacAddress) + } + } + if err := multierror.Join(errs...); err != nil { return fmt.Errorf("invalid endpoint settings:\n%w", err) }