Skip to content

Commit 23bfbdf

Browse files
committed
c8d/delete: Require --force when deleting platforms
When deleting specific platforms from a multi-platform image, there's potential risk as platform-specific content might be shared across images/containers. For now, require `force` parameter to make the user aware. Signed-off-by: Paweł Gronowski <[email protected]>
1 parent a2bc5f1 commit 23bfbdf

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

daemon/containerd/image_delete.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, options
6565
}
6666
}()
6767

68+
if len(options.Platforms) > 0 && !options.Force {
69+
return nil, cerrdefs.ErrInvalidArgument.WithMessage("Deleting specific platforms is currently considered potentially unsafe because platform-specific content might be shared across images/containers. Use --force to override.")
70+
}
71+
6872
force := options.Force
6973
prune := options.PruneChildren
7074

0 commit comments

Comments
 (0)