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

Function getImageRef

core/image.go:206–221  ·  view source on GitHub ↗

getImageRef returns the image digest if exists, or else returns the image ID.

(client libdocker.DockerClientInterface, image string)

Source from the content-addressed store, hash-verified

204
205// getImageRef returns the image digest if exists, or else returns the image ID.
206func getImageRef(client libdocker.DockerClientInterface, image string) (string, error) {
207 img, err := client.InspectImageByRef(image)
208 if err != nil {
209 return "", err
210 }
211 if img == nil {
212 return "", fmt.Errorf("unable to inspect image %s", image)
213 }
214
215 // Returns the digest if it exist.
216 if len(img.RepoDigests) > 0 {
217 return img.RepoDigests[0], nil
218 }
219
220 return img.ID, nil
221}
222
223func filterHTTPError(err error, image string) error {
224 // docker/docker/pull/11314 prints detailed error info for docker pull.

Callers 1

PullImageMethod · 0.85

Calls 2

lenFunction · 0.85
InspectImageByRefMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…