diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-05-05 09:20:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-05 09:20:16 -0400 |
commit | a278195af3423f882c1f5bb218792f7c2ce10a3c (patch) | |
tree | 192e52054de2abf0c92d83ecdbc71d498c2ec947 /libpod/reset.go | |
parent | 8eefca5a257121b177562742c972e39e1686140d (diff) | |
parent | 0f7d54b0260c1be992ee3b9cee359ef3a9e8bd21 (diff) | |
download | podman-a278195af3423f882c1f5bb218792f7c2ce10a3c.tar.gz podman-a278195af3423f882c1f5bb218792f7c2ce10a3c.tar.bz2 podman-a278195af3423f882c1f5bb218792f7c2ce10a3c.zip |
Merge pull request #10147 from vrothberg/new-image-package
migrate Podman to containers/common/libimage
Diffstat (limited to 'libpod/reset.go')
-rw-r--r-- | libpod/reset.go | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libpod/reset.go b/libpod/reset.go index 4199e9b76..8e753e845 100644 --- a/libpod/reset.go +++ b/libpod/reset.go @@ -6,7 +6,9 @@ import ( "os" "path/filepath" + "github.com/containers/common/libimage" "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/errorhandling" "github.com/containers/podman/v3/pkg/rootless" "github.com/containers/podman/v3/pkg/util" "github.com/containers/storage" @@ -49,20 +51,11 @@ func (r *Runtime) Reset(ctx context.Context) error { logrus.Errorf("Error stopping pause process: %v", err) } - ir := r.ImageRuntime() - images, err := ir.GetImages() - if err != nil { - return err + rmiOptions := &libimage.RemoveImagesOptions{Filters: []string{"readonly=false"}} + if _, rmiErrors := r.LibimageRuntime().RemoveImages(ctx, nil, rmiOptions); rmiErrors != nil { + return errorhandling.JoinErrors(rmiErrors) } - for _, i := range images { - if err := i.Remove(ctx, true); err != nil { - if errors.Cause(err) == define.ErrNoSuchImage { - continue - } - logrus.Errorf("Error removing image %s: %v", i.ID(), err) - } - } volumes, err := r.state.AllVolumes() if err != nil { return err |