(imageName string)
| 333 | } |
| 334 | |
| 335 | func PullImage(imageName string) error { |
| 336 | cli, err := NewDockerClient() |
| 337 | if err != nil { |
| 338 | return err |
| 339 | } |
| 340 | defer cli.Close() |
| 341 | options := image.PullOptions{} |
| 342 | if authStr, ok := loadRegistryAuthFromDockerConfig(imageName); ok { |
| 343 | options.RegistryAuth = authStr |
| 344 | } |
| 345 | if _, err := cli.ImagePull(context.Background(), imageName, options); err != nil { |
| 346 | return err |
| 347 | } |
| 348 | return nil |
| 349 | } |
| 350 | |
| 351 | func loadRegistryAuthFromDockerConfig(imageName string) (string, bool) { |
| 352 | registryHost, hasRegistry := extractRegistryHost(imageName) |
nothing calls this directly
no test coverage detected