Merge pull request #309 from thaJeztah/19.03_backport_prevent_network_attach_panic
[19.03 backport] Prevent panic on network attach
This commit is contained in:
commit
cbdf487768
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 {
|
func (daemon *Daemon) updateNetworkSettings(container *container.Container, n libnetwork.Network, endpointConfig *networktypes.EndpointSettings) error {
|
||||||
if container.NetworkSettings == nil {
|
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() {
|
if !container.HostConfig.NetworkMode.IsHost() && containertypes.NetworkMode(n.Type()).IsHost() {
|
||||||
|
|
Loading…
Reference in a new issue