Add the rmi flag to podman-run to delete container image

The --rmi flag will delete the container image after its execution
unless that image is already been used by another container(s).

This is useful when one wants to execute a container once and remove
any resources attached to it.

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
This commit is contained in:
Boaz Shuster
2020-01-01 09:53:25 +02:00
parent 1641ee6180
commit 11e5c53d11
9 changed files with 70 additions and 3 deletions

View File

@ -136,4 +136,21 @@ echo $rand | 0 | $rand
run_podman rmi busybox
}
# 'run --rmi' deletes the image in the end unless it's used by another container.
@test "podman run --rmi - remove image" {
skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
run_podman 0 run --rmi --rm redis /bin/true
run_podman 1 image exists redis
}
@test "podman run --rmi - not remove image" {
skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
run_podman run redis /bin/true
run_podman images | grep redis
run_podman run --rmi --rm redis /bin/true
run_podman images | grep redis
run_podman 0 rm -a
}
# vim: filetype=sh