mirror of
https://github.com/containers/podman.git
synced 2025-06-24 11:28:24 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user