PullImage pulls an image with authentication config.
( _ context.Context, r *runtimeapi.PullImageRequest, )
| 133 | |
| 134 | // PullImage pulls an image with authentication config. |
| 135 | func (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. |
| 167 | func (ds *dockerService) RemoveImage( |
nothing calls this directly
no test coverage detected