Skip to content

Commit

Permalink
Ignore ErrLayerUnknown error when attempting to cleanup container
Browse files Browse the repository at this point in the history
Fixes: containers#11207

[NO TESTS NEEDED] Since I don't know how to get into this situation.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed Sep 16, 2021
1 parent 9119a57 commit b8f6b5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libpod/runtime_cstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
return errors.Wrapf(define.ErrCtrStateInvalid, "container %q is mounted and cannot be removed without using force", idOrName)
}
} else if _, err := r.store.Unmount(ctr.ID, true); err != nil {
if errors.Cause(err) == storage.ErrContainerUnknown {
if errors.Is(err, storage.ErrContainerUnknown) {
// Container again gone, no error
logrus.Infof("Storage for container %s already removed", ctr.ID)
return nil
}
return errors.Wrapf(err, "error unmounting container %q", idOrName)
if !errors.Is(err, storage.ErrLayerUnknown) {
return errors.Wrapf(err, "error unmounting container %q", idOrName)
}
}

if err := r.store.DeleteContainer(ctr.ID); err != nil {
Expand Down

0 comments on commit b8f6b5e

Please sign in to comment.