MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / PullImage

Function PullImage

agent/utils/docker/docker.go:335–349  ·  view source on GitHub ↗
(imageName string)

Source from the content-addressed store, hash-verified

333}
334
335func 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
351func loadRegistryAuthFromDockerConfig(imageName string) (string, bool) {
352 registryHost, hasRegistry := extractRegistryHost(imageName)

Callers

nothing calls this directly

Calls 4

NewDockerClientFunction · 0.85
CloseMethod · 0.65
ImagePullMethod · 0.65

Tested by

no test coverage detected