From bfc065f2c4dcfc969981453e49b8156330674006 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Tue, 27 Feb 2024 22:20:41 +0100 Subject: container: T6074: do not allow deleting images which have a container running The current VyOS container image manipulation "delete container image" command allows force removal of container images - even if they still have a container running. Drop the --force option from the op-mode script. vyos@vyos:~$ delete container image 2636705a815a Error: image used by 6adb0175d47f.. image is in use by a container: consider listing external containers and force-removing image --- src/op_mode/container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/op_mode/container.py b/src/op_mode/container.py index dcbb4dc55..d29af8821 100755 --- a/src/op_mode/container.py +++ b/src/op_mode/container.py @@ -75,7 +75,7 @@ def delete_image(name: str): if not name: return # replace newline with whitespace name = name.replace('\n', ' ') - rc, output = rc_cmd(f'podman image rm --force {name}') + rc, output = rc_cmd(f'podman image rm {name}') if rc != 0: raise vyos.opmode.InternalError(output) -- cgit v1.2.3