MCPcopy
hub / github.com/perkeep/perkeep / pull

Function pull

internal/images/docker.go:93–107  ·  view source on GitHub ↗

Pull retrieves the docker image with 'docker pull'.

(image string)

Source from the content-addressed store, hash-verified

91
92// Pull retrieves the docker image with 'docker pull'.
93func pull(image string) error {
94 var stdout, stderr bytes.Buffer
95 cmd := exec.Command("docker", "pull", image)
96 cmd.Stdout = &stdout
97 cmd.Stderr = &stderr
98 err := cmd.Run()
99 out := stdout.String()
100 // TODO(mpl): if it turns out docker respects conventions and the
101 // "Authentication is required" message does come from stderr, then quit
102 // checking stdout.
103 if err != nil || stderr.Len() != 0 || strings.Contains(out, "Authentication is required") {
104 return fmt.Errorf("docker pull failed: stdout: %s, stderr: %s, err: %v", out, stderr.String(), err)
105 }
106 return nil
107}

Callers 1

setUpThumbnailContainerFunction · 0.85

Calls 5

ContainsMethod · 0.80
CommandMethod · 0.65
RunMethod · 0.65
LenMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected