зеркало из https://github.com/microsoft/docker.git
Merge pull request #19429 from mavenugo/epv21
nil ptr check for endpointsettings when used with older clients
This commit is contained in:
Коммит
6a1100cafc
|
@ -757,21 +757,20 @@ func (daemon *Daemon) connectToNetwork(container *container.Container, idOrName
|
|||
return nil
|
||||
}
|
||||
|
||||
if !containertypes.NetworkMode(idOrName).IsUserDefined() && hasUserDefinedIPAddress(endpointConfig) {
|
||||
return runconfig.ErrUnsupportedNetworkAndIP
|
||||
}
|
||||
|
||||
if !containertypes.NetworkMode(idOrName).IsUserDefined() && len(endpointConfig.Aliases) > 0 {
|
||||
return runconfig.ErrUnsupportedNetworkAndAlias
|
||||
}
|
||||
|
||||
controller := daemon.netController
|
||||
|
||||
if err := validateNetworkingConfig(n, endpointConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if endpointConfig != nil {
|
||||
if !containertypes.NetworkMode(idOrName).IsUserDefined() && hasUserDefinedIPAddress(endpointConfig) {
|
||||
return runconfig.ErrUnsupportedNetworkAndIP
|
||||
}
|
||||
|
||||
if err := validateNetworkingConfig(n, endpointConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !containertypes.NetworkMode(idOrName).IsUserDefined() && len(endpointConfig.Aliases) > 0 {
|
||||
return runconfig.ErrUnsupportedNetworkAndAlias
|
||||
}
|
||||
container.NetworkSettings.Networks[n.Name()] = endpointConfig
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче