MCPcopy Create free account
hub / github.com/Mirantis/cri-dockerd / ImageStatus

Method ImageStatus

core/image.go:93–132  ·  view source on GitHub ↗

ImageStatus returns the status of the image, returns nil if the image doesn't present.

(
	_ context.Context,
	r *runtimeapi.ImageStatusRequest,
)

Source from the content-addressed store, hash-verified

91
92// ImageStatus returns the status of the image, returns nil if the image doesn't present.
93func (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.
135func (ds *dockerService) PullImage(

Callers

nothing calls this directly

Calls 8

sandboxImageMethod · 0.95
IsImageNotFoundErrorFunction · 0.92
isPinnedFunction · 0.85
InspectImageByRefMethod · 0.65
InspectImageByIDMethod · 0.65
ImageHistoryMethod · 0.65

Tested by

no test coverage detected