aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBoaz Shuster <boaz.shuster.github@gmail.com>2020-01-01 09:53:25 +0200
committerBoaz Shuster <boaz.shuster.github@gmail.com>2020-03-03 14:27:11 +0200
commit11e5c53d1191f7a324f212aa2ca2ec2aad1b4676 (patch)
treed90b96daccd6e8459adac7a5553766c858bc3bde /test
parent1641ee61802ad5e13a9ddf0a20099fe31f73768d (diff)
downloadpodman-11e5c53d1191f7a324f212aa2ca2ec2aad1b4676.tar.gz
podman-11e5c53d1191f7a324f212aa2ca2ec2aad1b4676.tar.bz2
podman-11e5c53d1191f7a324f212aa2ca2ec2aad1b4676.zip
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>
Diffstat (limited to 'test')
-rw-r--r--test/system/030-run.bats17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index f1e9776c1..b89c76981 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -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