From eba2ca2695a189d7a3018c20b5a342040a3a88e0 Mon Sep 17 00:00:00 2001 From: Justin Zhang Date: Sat, 10 May 2025 14:05:44 +0300 Subject: [PATCH] Skip running compose-down during up when there are no active containers Signed-off-by: Povilas Kanapickas --- newsfragments/down-during-up-no-containers.bugfix | 1 + podman_compose.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 newsfragments/down-during-up-no-containers.bugfix diff --git a/newsfragments/down-during-up-no-containers.bugfix b/newsfragments/down-during-up-no-containers.bugfix new file mode 100644 index 0000000..ed4e319 --- /dev/null +++ b/newsfragments/down-during-up-no-containers.bugfix @@ -0,0 +1 @@ +Skip running compose-down during up when there are no active containers diff --git a/podman_compose.py b/podman_compose.py index 69613e3..22d55cd 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -2891,7 +2891,7 @@ async def compose_up(compose: PodmanCompose, args): .splitlines() ) diff_hashes = [i for i in hashes if i and i != compose.yaml_hash] - if args.force_recreate or len(diff_hashes): + if (args.force_recreate and len(hashes) > 0) or len(diff_hashes): log.info("recreating: ...") down_args = argparse.Namespace(**dict(args.__dict__, volumes=False, rmi=None)) await compose.commands["down"](compose, down_args)