Skip to content

Commit 3caf416

Browse files
authored
Merge pull request #3192 from apostasie/dev-urgent
[PRIORITY] Do not hard error if containers are gone
2 parents dea88dc + 156b5fd commit 3caf416

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/cmd/container/run_mount.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package container
1919
import (
2020
"context"
2121
"encoding/json"
22+
"errors"
2223
"fmt"
2324
"os"
2425
"path/filepath"
@@ -307,6 +308,12 @@ func generateMountOpts(ctx context.Context, client *containerd.Client, ensuredIm
307308
for _, c := range containers {
308309
ls, err := c.Labels(ctx)
309310
if err != nil {
311+
// Containerd note: there is no guarantee that the containers we got from the list still exist at this point
312+
// If that is the case, just ignore and move on
313+
if errors.Is(err, errdefs.ErrNotFound) {
314+
log.G(ctx).Debugf("container %q is gone - ignoring", c.ID())
315+
continue
316+
}
310317
return nil, nil, nil, err
311318
}
312319
_, idMatch := vfSet[c.ID()]

pkg/cmd/volume/rm.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func usedVolumes(ctx context.Context, containers []containerd.Container) (map[st
7979
// Containerd note: there is no guarantee that the containers we got from the list still exist at this point
8080
// If that is the case, just ignore and move on
8181
if errors.Is(err, errdefs.ErrNotFound) {
82+
log.G(ctx).Debugf("container %q is gone - ignoring", c.ID())
8283
continue
8384
}
8485
return nil, err

0 commit comments

Comments
 (0)