docker_compose_v2: work around bug in docker compose images --format json (#1083) (#1084)

* Work around ubg in docker compose images --format json.

* ContainerName is no longer in image record.

(cherry picked from commit 8ecbd9a5cc)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2025-06-08 09:24:44 +02:00
committed by GitHub
parent 36d98ee0d5
commit 6e2505cd48
6 changed files with 21 additions and 4 deletions
+5
View File
@@ -800,6 +800,11 @@ class BaseComposeManager(DockerBaseClass):
rc, images, stderr = self.client.call_cli_json(*args, **kwargs)
if self.use_json_events and rc != 0:
self._handle_failed_cli_call(args, rc, images, stderr)
if isinstance(images, dict):
# Handle breaking change in Docker Compose 2.37.0; see
# https://github.com/ansible-collections/community.docker/issues/1082
# and https://github.com/docker/compose/issues/12916 for details
images = list(images.values())
return images
def parse_events(self, stderr, dry_run=False, nonzero_rc=False):