Skip running compose-down during up when there are no active containers

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Justin Zhang 2025-05-10 14:05:44 +03:00 committed by Povilas Kanapickas
parent abe5965c9a
commit eba2ca2695
2 changed files with 2 additions and 1 deletions

View File

@ -0,0 +1 @@
Skip running compose-down during up when there are no active containers

View File

@ -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)