diff --git a/api/server/router/network/network_routes.go b/api/server/router/network/network_routes.go index 0ef70c6f7f..e4b5d740bc 100644 --- a/api/server/router/network/network_routes.go +++ b/api/server/router/network/network_routes.go @@ -191,7 +191,11 @@ func buildNetworkResource(nw libnetwork.Network) *types.NetworkResource { epl := nw.Endpoints() for _, e := range epl { - sb := e.Info().Sandbox() + ei := e.Info() + if ei == nil { + continue + } + sb := ei.Sandbox() if sb == nil { continue } @@ -233,7 +237,12 @@ func buildEndpointResource(e libnetwork.Endpoint) types.EndpointResource { } er.EndpointID = e.ID() - if iface := e.Info().Iface(); iface != nil { + ei := e.Info() + if ei == nil { + return er + } + + if iface := ei.Iface(); iface != nil { if mac := iface.MacAddress(); mac != nil { er.MacAddress = mac.String() } diff --git a/daemon/container_unix.go b/daemon/container_unix.go index a4b9cd5a6d..db4d5b890e 100644 --- a/daemon/container_unix.go +++ b/daemon/container_unix.go @@ -1191,7 +1191,11 @@ func (container *Container) disconnectFromNetwork(n libnetwork.Network) error { ) s := func(current libnetwork.Endpoint) bool { - if sb := current.Info().Sandbox(); sb != nil { + epInfo := current.Info() + if epInfo == nil { + return false + } + if sb := epInfo.Sandbox(); sb != nil { if sb.ContainerID() == container.ID { ep = current sbox = sb