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
|
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.
|
// Check if can remove the parent image.
|
||||||
if parent == nil {
|
if parent == nil {
|
||||||
return processedIDs, nil
|
return processedIDs, nil
|
||||||
|
|
@ -495,7 +500,6 @@ func (i *Image) removeRecursive(ctx context.Context, rmMap map[string]*RemoveIma
|
||||||
if !danglingParent {
|
if !danglingParent {
|
||||||
return processedIDs, nil
|
return processedIDs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recurse into removing the parent.
|
// Recurse into removing the parent.
|
||||||
return parent.removeRecursive(ctx, rmMap, processedIDs, "", options)
|
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
|
// much space was freed. However, computing the size of an image is
|
||||||
// comparatively expensive, so it is made optional.
|
// comparatively expensive, so it is made optional.
|
||||||
WithSize bool
|
WithSize bool
|
||||||
|
// NoPrune will not remove dangling images
|
||||||
|
NoPrune bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveImages removes images specified by names. If no names are specified,
|
// 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{}
|
toDelete := []string{}
|
||||||
// Look up images in the local containers storage and fill out
|
// Look up images in the local containers storage and fill out
|
||||||
// toDelete and the deleteMap.
|
// toDelete and the deleteMap.
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case len(names) > 0:
|
case len(names) > 0:
|
||||||
// prepare lookupOptions
|
// prepare lookupOptions
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue