diff --git a/newsfragments/check-if-pod-exists.bugfix b/newsfragments/check-if-pod-exists.bugfix new file mode 100644 index 00000000..8c4a472d --- /dev/null +++ b/newsfragments/check-if-pod-exists.bugfix @@ -0,0 +1 @@ +Fixed a bug that caused attempts to create already existing pods multiple times. diff --git a/podman_compose.py b/podman_compose.py index 200ce787..5c2d6bbb 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -2422,8 +2422,16 @@ async def compose_build(compose, args): return status +async def pod_exists(compose, name): + exit_code = await compose.podman.run([], "pod", ["exists", name]) + return exit_code == 0 + + async def create_pods(compose, args): # pylint: disable=unused-argument for pod in compose.pods: + if await pod_exists(compose, pod["name"]): + continue + podman_args = [ "create", "--name=" + pod["name"],