Sfoglia il codice sorgente

Restore images format list format behaviour

Signed-off-by: x0rw <[email protected]>
x0rw 7 mesi fa
parent
commit
ea48480d80
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      cmd/compose/images.go

+ 8 - 0
cmd/compose/images.go

@@ -87,6 +87,14 @@ func runImages(ctx context.Context, dockerCli command.Cli, backend api.Service,
 		}
 		return nil
 	}
+	if opts.Format == "json" {
+		// Convert map to slice
+		var imageList []api.ImageSummary
+		for _, img := range images {
+			imageList = append(imageList, img)
+		}
+		return formatter.Print(imageList, opts.Format, dockerCli.Out(), nil)
+	}
 
 	return formatter.Print(images, opts.Format, dockerCli.Out(),
 		func(w io.Writer) {