allow forcing an image removal

This commit is contained in:
Jesse Duffield 2022-05-11 19:38:53 +10:00
parent d3e84881bb
commit 62be3d9924
2 changed files with 116 additions and 99 deletions

View file

@ -212,17 +212,30 @@ func (gui *Gui) handleImagesRemoveMenu(g *gocui.Gui, v *gocui.View) error {
shortSha := Image.ID[7:17]
// TODO: have a way of toggling in a menu instead of showing each permutation as a separate menu item
options := []*removeImageOption{
{
description: gui.Tr.Remove,
command: "docker image rm " + shortSha,
configOptions: types.ImageRemoveOptions{PruneChildren: true},
configOptions: types.ImageRemoveOptions{PruneChildren: true, Force: false},
runCommand: true,
},
{
description: gui.Tr.RemoveWithoutPrune,
command: "docker image rm --no-prune " + shortSha,
configOptions: types.ImageRemoveOptions{PruneChildren: false},
configOptions: types.ImageRemoveOptions{PruneChildren: false, Force: false},
runCommand: true,
},
{
description: gui.Tr.RemoveWithForce,
command: "docker image rm --force " + shortSha,
configOptions: types.ImageRemoveOptions{PruneChildren: true, Force: true},
runCommand: true,
},
{
description: gui.Tr.RemoveWithoutPruneWithForce,
command: "docker image rm --no-prune --force " + shortSha,
configOptions: types.ImageRemoveOptions{PruneChildren: false, Force: true},
runCommand: true,
},
{

View file

@ -66,6 +66,8 @@ type TranslationSet struct {
RemoveImage string
RemoveVolume string
RemoveWithoutPrune string
RemoveWithoutPruneWithForce string
RemoveWithForce string
PruneImages string
PruneContainers string
PruneVolumes string
@ -151,6 +153,8 @@ func englishSet() TranslationSet {
RemoveImage: "remove image",
RemoveVolume: "remove volume",
RemoveWithoutPrune: "remove without deleting untagged parents",
RemoveWithoutPruneWithForce: "remove (forced) without deleting untagged parents",
RemoveWithForce: "remove (forced)",
PruneContainers: "prune exited containers",
PruneVolumes: "prune unused volumes",
PruneImages: "prune unused images",