mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
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:
parent
b8600d766b
commit
88478f3749
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user