From bc8336dc0dcdf7128a7cc8bcfac1c76c22fb44ed Mon Sep 17 00:00:00 2001 From: cdoern Date: Fri, 1 Oct 2021 12:39:27 -0400 Subject: [PATCH] Pod Removal with only container being infra Pods were sometimes failing to remove if infra was running. Added a pod stop command and --force flag to pod rm within compose_down resolves containers/podman#11713 Signed-off-by: cdoern --- podman_compose.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/podman_compose.py b/podman_compose.py index 969d2235..3a48543f 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -1358,7 +1358,7 @@ def compose_up(compose, args): podman_args = container_to_args(compose, cnt, detached=args.detach) subproc = compose.podman.run([], podman_command, podman_args) if podman_command == 'run' and subproc.returncode: - compose.podman.run([], 'start', [cnt['name']]) + compose.podman.run([], 'start', [cnt['name']]) # potentila issue using container run instead of pod start if args.no_start or args.detach or args.dry_run: return # TODO: handle already existing @@ -1395,7 +1395,8 @@ def compose_down(compose, args): for cnt in compose.containers: compose.podman.run([], "rm", [cnt["name"]], sleep=0) for pod in compose.pods: - compose.podman.run([], "pod", ["rm", pod["name"]], sleep=0) + compose.podman.run([], "pod", ["stop", pod["name"]], sleep=0) # stop pod for the purpose of stopping infra container if still running + compose.podman.run([], "pod", ["rm", "--force", pod["name"]], sleep=0) @cmd_run(podman_compose, 'ps', 'show status of containers') def compose_ps(compose, args):