diff --git a/libnetwork/sandbox.go b/libnetwork/sandbox.go index 6f4c2508b2..c8f5a8abcb 100644 --- a/libnetwork/sandbox.go +++ b/libnetwork/sandbox.go @@ -916,6 +916,13 @@ func (sb *sandbox) clearNetworkResources(origEp *endpoint) error { break } } + + if index == -1 { + logrus.Errorf("Endpoint %s has already been deleted", ep.Name()) + sb.Unlock() + return nil + } + heap.Remove(&sb.endpoints, index) for _, e := range sb.endpoints { if len(e.Gateway()) > 0 {