MCPcopy
hub / github.com/docker/compose / inspectWithPull

Function inspectWithPull

pkg/bridge/convert.go:225–245  ·  pkg/bridge/convert.go::inspectWithPull
(ctx context.Context, dockerCli command.Cli, imageName string)

Source from the content-addressed store, hash-verified

223}
224
225func inspectWithPull(ctx context.Context, dockerCli command.Cli, imageName string) (image.InspectResponse, error) {
226 inspect, err := dockerCli.Client().ImageInspect(ctx, imageName)
227 if errdefs.IsNotFound(err) {
228 var stream io.ReadCloser
229 stream, err = dockerCli.Client().ImagePull(ctx, imageName, client.ImagePullOptions{})
230 if err != nil {
231 return image.InspectResponse{}, err
232 }
233 defer func() { _ = stream.Close() }()
234
235 out := dockerCli.Out()
236 err = jsonmessage.DisplayJSONMessagesStream(stream, out, out.FD(), out.IsTerminal(), nil)
237 if err != nil {
238 return image.InspectResponse{}, err
239 }
240 if inspect, err = dockerCli.Client().ImageInspect(ctx, imageName); err != nil {
241 return image.InspectResponse{}, err
242 }
243 }
244 return inspect.InspectResponse, err
245}

Callers 2

convertFunction · 0.85
LoadAdditionalResourcesFunction · 0.85

Calls 5

CloseMethod · 0.65
ImageInspectMethod · 0.45
ClientMethod · 0.45
ImagePullMethod · 0.45
OutMethod · 0.45

Tested by

no test coverage detected