mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 12:33:02 +02:00
container: make 'container remove' cli command slightly more useful
Usually, when your system is up and running properly, you want to clean up anything unused from your previous experiments. This change alllows that by calling the interactive 'podman image prune -a -f' command from the CLI command 'container remove all' Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -584,7 +584,7 @@ usage:
|
||||
container [opt] cmd [arg]
|
||||
|
||||
options:
|
||||
-a, --all Show all, of something
|
||||
-a, --all Show all, do all, remove all, of something
|
||||
--dns NAMESERVER Set nameserver(s) when creating a container
|
||||
--dns-search LIST Set host lookup search list when creating container
|
||||
--cap-add CAP Add capability to unprivileged container
|
||||
@@ -624,7 +624,7 @@ commands:
|
||||
list [image | oci] List names (only) of containers, images, or OCI archives
|
||||
load [NAME | URL] NM Load OCI tarball fileNAME or URL to image NM
|
||||
locate Find container that currently owns '--net IFNAME'
|
||||
remove IMAGE Remove an (unused) container image
|
||||
remove [IMAGE] Remove an image, or prune unused images including OCI archives
|
||||
restart [network] NAME Restart a (crashed) container or container(s) using network
|
||||
run NAME [CMD] Run a container interactively, with an optional command
|
||||
save IMAGE FILE Save a container image to an OCI tarball FILE[.tar.gz]
|
||||
@@ -876,7 +876,14 @@ case $cmd in
|
||||
podman pull "$@"
|
||||
;;
|
||||
remove)
|
||||
podman rmi $all $force -i "$1"
|
||||
if [ -n "$all" ]; then
|
||||
log "Removing all OCI archives from $DOWNLOADS directory ..."
|
||||
find "${DOWNLOADS:?}" -mindepth 1 -exec rm -rf {} +
|
||||
log "Removing all unused container images ..."
|
||||
podman image prune $all $force
|
||||
else
|
||||
podman rmi $force -i "$1"
|
||||
fi
|
||||
;;
|
||||
run)
|
||||
img=$1
|
||||
|
||||
@@ -102,9 +102,14 @@
|
||||
</COMMAND>
|
||||
|
||||
<COMMAND name="remove" help="Remove a container image from local storage">
|
||||
<PARAM name="name" ptype="/IMAGES" help="Image name" />
|
||||
<SWITCH name="optional" min="0">
|
||||
<PARAM name="name" ptype="/IMAGES" help="Image name" />
|
||||
</SWITCH>
|
||||
<ACTION sym="script" in="tty" out="tty" interrupt="true">
|
||||
doas container remove $KLISH_PARAM_name
|
||||
if [ -n "$KLISH_PARAM_name" ]; then
|
||||
all=-a
|
||||
fi
|
||||
doas container $all remove $KLISH_PARAM_name
|
||||
</ACTION>
|
||||
</COMMAND>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user