diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-28 07:34:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-28 07:34:12 -0400 |
commit | f2ffb96eb317012e94258a242f6dc907acd22c40 (patch) | |
tree | de48efeabf92b80e8cc69c456f33908124630769 /pkg/api | |
parent | 340166876eab09d3e363647213f162864a95d270 (diff) | |
parent | a9a54eefab34b25628906a786d6c4ca302f743b1 (diff) | |
download | podman-f2ffb96eb317012e94258a242f6dc907acd22c40.tar.gz podman-f2ffb96eb317012e94258a242f6dc907acd22c40.tar.bz2 podman-f2ffb96eb317012e94258a242f6dc907acd22c40.zip |
Merge pull request #11737 from vrothberg/fix-11472
image prune: support removing external containers
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/libpod/images.go | 8 | ||||
-rw-r--r-- | pkg/api/server/register_images.go | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index 0023479ea..1c6cc917c 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -150,7 +150,8 @@ func PruneImages(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime) decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder) query := struct { - All bool `schema:"all"` + All bool `schema:"all"` + External bool `schema:"external"` }{ // override any golang type defaults } @@ -190,8 +191,9 @@ func PruneImages(w http.ResponseWriter, r *http.Request) { imageEngine := abi.ImageEngine{Libpod: runtime} pruneOptions := entities.ImagePruneOptions{ - All: query.All, - Filter: libpodFilters, + All: query.All, + External: query.External, + Filter: libpodFilters, } imagePruneReports, err := imageEngine.Prune(r.Context(), pruneOptions) if err != nil { diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 5e0de7def..aa573eaa6 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -1050,6 +1050,12 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // description: | // Remove all images not in use by containers, not just dangling ones // - in: query + // name: external + // default: false + // type: boolean + // description: | + // Remove images even when they are used by external containers (e.g, by build containers) + // - in: query // name: filters // type: string // description: | |