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

Method PullImage

core/image.go:135–164  ·  view source on GitHub ↗

PullImage pulls an image with authentication config.

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

Source from the content-addressed store, hash-verified

133
134// PullImage pulls an image with authentication config.
135func (ds *dockerService) PullImage(
136 _ context.Context,
137 r *runtimeapi.PullImageRequest,
138) (*runtimeapi.PullImageResponse, error) {
139 image := r.GetImage()
140 auth := r.GetAuth()
141 authConfig := dockerregistry.AuthConfig{}
142
143 if auth != nil {
144 authConfig.Username = auth.Username
145 authConfig.Password = auth.Password
146 authConfig.ServerAddress = auth.ServerAddress
147 authConfig.IdentityToken = auth.IdentityToken
148 authConfig.RegistryToken = auth.RegistryToken
149 }
150 err := ds.client.PullImage(image.Image,
151 authConfig,
152 dockertypes.ImagePullOptions{},
153 )
154 if err != nil {
155 return nil, filterHTTPError(err, image.Image)
156 }
157
158 imageRef, err := getImageRef(ds.client, image.Image)
159 if err != nil {
160 return nil, err
161 }
162
163 return &runtimeapi.PullImageResponse{ImageRef: imageRef}, nil
164}
165
166// RemoveImage removes the image.
167func (ds *dockerService) RemoveImage(

Callers

nothing calls this directly

Calls 3

filterHTTPErrorFunction · 0.85
getImageRefFunction · 0.85
PullImageMethod · 0.65

Tested by

no test coverage detected