diff --git a/src/algokit/core/sandbox.py b/src/algokit/core/sandbox.py index c9a5914a..6800075c 100644 --- a/src/algokit/core/sandbox.py +++ b/src/algokit/core/sandbox.py @@ -116,7 +116,14 @@ def ps(self, service_name: str | None = None) -> list[dict[str, Any]]: ) if run_results.exit_code != 0: return [] - data = json.loads(run_results.output) + + # `docker compose ps --format json` on version < 2.21.0 outputs a JSON arary + if run_results.output.startswith("["): + data = json.loads(run_results.output) + # `docker compose ps --format json` on version >= 2.21.0 outputs seperate JSON objects, each on a new line + else: + data = [json.loads(line) for line in run_results.output.splitlines() if line] + assert isinstance(data, list) return cast(list[dict[str, Any]], data)