weaveworks / ignite

Ignite a Firecracker microVM
https://ignite.readthedocs.org
Apache License 2.0
3.49k stars 224 forks source link

proposal: cmd: add -a(all) flag to ignite image rm command #869

Open GrigoriyMikhalkin opened 2 years ago

GrigoriyMikhalkin commented 2 years ago

Currently, to remove all images user needs to specify each image ID or name by hand, which is quite inconvenient. It would be useful to have flag --all(short: -a)) for ignite image rm command, that would allow to remove all existing images.

stealthybox commented 2 years ago

The docker equivalent way to do this is:

docker image rm $(docker image ls -q)

This also works for ignite:

sudo ignite image rm $(sudo ignite image ls -q)

How does that solution look to you? It's not as simple as a single flag, but it's been that way with docker for a long time.

Another related docker command that we would consider adding would be docker image prune --all

GrigoriyMikhalkin commented 2 years ago

@stealthybox IMO, it's a little bit complex(i.e. needs memorization). I usually use docker image prune -a command, as you mentioned.

If it's ok, i would like to work on adding ignite image prune command (with --all flag). Question is, would prune command be identical to rm command in context of ignite(besides --all flag)?

darkowlzz commented 2 years ago

Hi @GrigoriyMikhalkin , the prune command in docker is used to remove dangling images by default and -a is a special case. In case of ignite, I don't think we have dangling images. So the behavior of image prune in ignite would likely be to just remove the unused images. I don't think we'd like to implement -a to remove all the image, even the ones in use by VMs. To get started, I would recommend implementing the prune command to look for images that aren't in use by any VMs and remove those only. That should be the core of the implementation. If we can think of a need for something like -a or --filter, we can add that later. Also, the OS images and kernel images have similar commands. Once you've the implementation for OS images, we can also add a similar subcommand for kernel images. You can also join the weaveworks slack to discuss more about it or we can continue discussing more here.