ImageStatus returns the status of the image, returns nil if the image doesn't present.
( _ context.Context, r *runtimeapi.ImageStatusRequest, )
| 91 | |
| 92 | // ImageStatus returns the status of the image, returns nil if the image doesn't present. |
| 93 | func (ds *dockerService) ImageStatus( |
| 94 | _ context.Context, |
| 95 | r *runtimeapi.ImageStatusRequest, |
| 96 | ) (*runtimeapi.ImageStatusResponse, error) { |
| 97 | image := r.GetImage() |
| 98 | |
| 99 | imageInspect, err := ds.client.InspectImageByRef(image.Image) |
| 100 | if err != nil { |
| 101 | if !libdocker.IsImageNotFoundError(err) { |
| 102 | return nil, err |
| 103 | } |
| 104 | imageInspect, err = ds.client.InspectImageByID(image.Image) |
| 105 | if err != nil { |
| 106 | if libdocker.IsImageNotFoundError(err) { |
| 107 | return &runtimeapi.ImageStatusResponse{}, nil |
| 108 | } |
| 109 | return nil, err |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | pinned := isPinned(ds.sandboxImage(), imageInspect.RepoTags) |
| 114 | imageStatus, err := imageInspectToRuntimeAPIImage(imageInspect, pinned) |
| 115 | if err != nil { |
| 116 | return nil, err |
| 117 | } |
| 118 | |
| 119 | res := runtimeapi.ImageStatusResponse{Image: imageStatus} |
| 120 | if r.GetVerbose() { |
| 121 | imageHistory, err := ds.client.ImageHistory(imageInspect.ID) |
| 122 | if err != nil { |
| 123 | return nil, err |
| 124 | } |
| 125 | imageInfo, err := imageInspectToRuntimeAPIImageInfo(imageInspect, imageHistory) |
| 126 | if err != nil { |
| 127 | return nil, err |
| 128 | } |
| 129 | res.Info = imageInfo |
| 130 | } |
| 131 | return &res, nil |
| 132 | } |
| 133 | |
| 134 | // PullImage pulls an image with authentication config. |
| 135 | func (ds *dockerService) PullImage( |
nothing calls this directly
no test coverage detected