Podman rmi --no-prune flag
containers/common changes for podman rmi --no-prune flag Signed-off-by: Karthik Elango <kelango@redhat.com>
This commit is contained in:
parent
598dfa231d
commit
ef56c45f69
|
|
@ -478,6 +478,11 @@ func (i *Image) removeRecursive(ctx context.Context, rmMap map[string]*RemoveIma
|
|||
report.Removed = true
|
||||
}
|
||||
|
||||
// Do not delete any parents if NoPrune is true
|
||||
if options.NoPrune {
|
||||
return processedIDs, nil
|
||||
}
|
||||
|
||||
// Check if can remove the parent image.
|
||||
if parent == nil {
|
||||
return processedIDs, nil
|
||||
|
|
@ -495,7 +500,6 @@ func (i *Image) removeRecursive(ctx context.Context, rmMap map[string]*RemoveIma
|
|||
if !danglingParent {
|
||||
return processedIDs, nil
|
||||
}
|
||||
|
||||
// Recurse into removing the parent.
|
||||
return parent.removeRecursive(ctx, rmMap, processedIDs, "", options)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -608,6 +608,8 @@ type RemoveImagesOptions struct {
|
|||
// much space was freed. However, computing the size of an image is
|
||||
// comparatively expensive, so it is made optional.
|
||||
WithSize bool
|
||||
// NoPrune will not remove dangling images
|
||||
NoPrune bool
|
||||
}
|
||||
|
||||
// RemoveImages removes images specified by names. If no names are specified,
|
||||
|
|
@ -653,7 +655,6 @@ func (r *Runtime) RemoveImages(ctx context.Context, names []string, options *Rem
|
|||
toDelete := []string{}
|
||||
// Look up images in the local containers storage and fill out
|
||||
// toDelete and the deleteMap.
|
||||
|
||||
switch {
|
||||
case len(names) > 0:
|
||||
// prepare lookupOptions
|
||||
|
|
|
|||
Loading…
Reference in New Issue