mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #39589 from thaJeztah/prevent_network_attach_panic
Prevent panic on network attach
This commit is contained in:
commit
9c92080b13
1 changed files with 4 additions and 1 deletions
|
@ -237,7 +237,10 @@ func (daemon *Daemon) buildSandboxOptions(container *container.Container) ([]lib
|
|||
|
||||
func (daemon *Daemon) updateNetworkSettings(container *container.Container, n libnetwork.Network, endpointConfig *networktypes.EndpointSettings) error {
|
||||
if container.NetworkSettings == nil {
|
||||
container.NetworkSettings = &network.Settings{Networks: make(map[string]*network.EndpointSettings)}
|
||||
container.NetworkSettings = &network.Settings{}
|
||||
}
|
||||
if container.NetworkSettings.Networks == nil {
|
||||
container.NetworkSettings.Networks = make(map[string]*network.EndpointSettings)
|
||||
}
|
||||
|
||||
if !container.HostConfig.NetworkMode.IsHost() && containertypes.NetworkMode(n.Type()).IsHost() {
|
||||
|
|
Loading…
Reference in a new issue