|
@@ -130,12 +130,8 @@ func (daemon *Daemon) getInspectData(daemonCfg *config.Config, container *contai
|
|
|
// unconditionally, to keep backward compatibility with clients that use
|
|
|
// unversioned API endpoints.
|
|
|
if container.Config != nil && container.Config.MacAddress == "" { //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.44.
|
|
|
- if nwm := hostConfig.NetworkMode; nwm.IsDefault() || nwm.IsBridge() || nwm.IsUserDefined() {
|
|
|
- name := nwm.NetworkName()
|
|
|
- if nwm.IsDefault() {
|
|
|
- name = daemon.netController.Config().DefaultNetwork
|
|
|
- }
|
|
|
- if epConf, ok := container.NetworkSettings.Networks[name]; ok {
|
|
|
+ if nwm := hostConfig.NetworkMode; nwm.IsBridge() || nwm.IsUserDefined() {
|
|
|
+ if epConf, ok := container.NetworkSettings.Networks[nwm.NetworkName()]; ok {
|
|
|
container.Config.MacAddress = epConf.DesiredMacAddress //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.44.
|
|
|
}
|
|
|
}
|