(ctx context.Context, dockerCLI command.Cli, opts inspectOptions)
| 57 | } |
| 58 | |
| 59 | func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error { |
| 60 | var platform *ocispec.Platform |
| 61 | if opts.platform != "" { |
| 62 | p, err := platforms.Parse(opts.platform) |
| 63 | if err != nil { |
| 64 | return err |
| 65 | } |
| 66 | platform = &p |
| 67 | } |
| 68 | |
| 69 | apiClient := dockerCLI.Client() |
| 70 | return inspect.Inspect(dockerCLI.Out(), opts.refs, opts.format, func(ref string) (any, []byte, error) { |
| 71 | var buf bytes.Buffer |
| 72 | resp, err := apiClient.ImageInspect(ctx, ref, |
| 73 | client.ImageInspectWithRawResponse(&buf), |
| 74 | client.ImageInspectWithPlatform(platform), |
| 75 | ) |
| 76 | if err != nil { |
| 77 | return image.InspectResponse{}, nil, err |
| 78 | } |
| 79 | return resp, buf.Bytes(), err |
| 80 | }) |
| 81 | } |
no test coverage detected
searching dependent graphs…