Skip to content

Commit 88478f3

Browse files
committed
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.
1 parent b8600d7 commit 88478f3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/e2e_node/image_list.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ func (dp *dockerPuller) Name() string {
9898
}
9999

100100
func (dp *dockerPuller) Pull(image string) ([]byte, error) {
101-
return exec.Command("docker", "pull", image).CombinedOutput()
101+
// TODO(random-liu): Use docker client to get rid of docker binary dependency.
102+
if exec.Command("docker", "inspect", "--type=image", image).Run() != nil {
103+
return exec.Command("docker", "pull", image).CombinedOutput()
104+
}
105+
return nil, nil
102106
}
103107

104108
type remotePuller struct {

0 commit comments

Comments
 (0)