Skip to content

Commit

Permalink
Merge pull request #3192 from apostasie/dev-urgent
Browse files Browse the repository at this point in the history
[PRIORITY] Do not hard error if containers are gone
  • Loading branch information
AkihiroSuda authored Jul 6, 2024
2 parents dea88dc + 156b5fd commit 3caf416
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/cmd/container/run_mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package container
import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -307,6 +308,12 @@ func generateMountOpts(ctx context.Context, client *containerd.Client, ensuredIm
for _, c := range containers {
ls, err := c.Labels(ctx)
if err != nil {
// Containerd note: there is no guarantee that the containers we got from the list still exist at this point
// If that is the case, just ignore and move on
if errors.Is(err, errdefs.ErrNotFound) {
log.G(ctx).Debugf("container %q is gone - ignoring", c.ID())
continue
}
return nil, nil, nil, err
}
_, idMatch := vfSet[c.ID()]
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/volume/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func usedVolumes(ctx context.Context, containers []containerd.Container) (map[st
// Containerd note: there is no guarantee that the containers we got from the list still exist at this point
// If that is the case, just ignore and move on
if errors.Is(err, errdefs.ErrNotFound) {
log.G(ctx).Debugf("container %q is gone - ignoring", c.ID())
continue
}
return nil, err
Expand Down

0 comments on commit 3caf416

Please sign in to comment.