Skip to content

Commit bedcc94

Browse files
committed
daemon: Handle NotFound when deleting container lease
If the lease doesn't exit (for example when creating the container failed), just ignore the not found error. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
1 parent dfaff95 commit bedcc94

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

daemon/delete.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"time"
1010

11+
cerrdefs "github.com/containerd/containerd/errdefs"
1112
"github.com/containerd/containerd/leases"
1213
"github.com/containerd/containerd/log"
1314
"github.com/docker/docker/api/types"
@@ -149,8 +150,10 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, config ty
149150
ID: container.ID,
150151
}
151152
if err := ls.Delete(context.Background(), lease, leases.SynchronousDelete); err != nil {
152-
container.SetRemovalError(err)
153-
return err
153+
if !cerrdefs.IsNotFound(err) {
154+
container.SetRemovalError(err)
155+
return err
156+
}
154157
}
155158
}
156159
}

0 commit comments

Comments
 (0)