From 11e5c53d1191f7a324f212aa2ca2ec2aad1b4676 Mon Sep 17 00:00:00 2001 From: Boaz Shuster Date: Wed, 1 Jan 2020 09:53:25 +0200 Subject: 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 --- pkg/spec/createconfig.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pkg/spec/createconfig.go') diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index 02678a687..eb2cac8b8 100644 --- a/pkg/spec/createconfig.go +++ b/pkg/spec/createconfig.go @@ -156,6 +156,7 @@ type CreateConfig struct { Resources CreateResourceConfig RestartPolicy string Rm bool //rm + Rmi bool //rmi StopSignal syscall.Signal // stop-signal StopTimeout uint // stop-timeout Systemd bool @@ -233,6 +234,10 @@ func (c *CreateConfig) createExitCommand(runtime *libpod.Runtime) ([]string, err command = append(command, "--rm") } + if c.Rmi { + command = append(command, "--rmi") + } + return command, nil } -- cgit v1.2.3-54-g00ecf