e2e_node: check if image exists locally before pulling

'docker pull' is a time consuming operation. It makes sense to check
if image exists locally before pulling it from a registry.

Checked if image exists by running 'docker inspect'. Only pull if
image doesn't exist.
This commit is contained in:
Ed Bartosh 2019-11-20 12:47:27 +02:00
parent b8600d766b
commit 88478f3749

View File

@ -98,7 +98,11 @@ func (dp *dockerPuller) Name() string {
}
func (dp *dockerPuller) Pull(image string) ([]byte, error) {
return exec.Command("docker", "pull", image).CombinedOutput()
// TODO(random-liu): Use docker client to get rid of docker binary dependency.
if exec.Command("docker", "inspect", "--type=image", image).Run() != nil {
return exec.Command("docker", "pull", image).CombinedOutput()
}
return nil, nil
}
type remotePuller struct {