From 0a2b1bf64459d2b4b70cbd041328de8e0b23bab5 Mon Sep 17 00:00:00 2001 From: Victor Marmol Date: Sun, 20 Jul 2014 10:31:26 -0700 Subject: [PATCH] If no tag was specified, pull "latest" explicitly. When no tag is given to Docker pull, it downloads all tags. This could be a significantly large number of images and in the end we only ever run :latest. --- pkg/kubelet/docker.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/docker.go b/pkg/kubelet/docker.go index 3123aacf7d8..7399c5d5e3a 100644 --- a/pkg/kubelet/docker.go +++ b/pkg/kubelet/docker.go @@ -65,6 +65,12 @@ func NewDockerPuller(client DockerInterface) DockerPuller { func (p dockerPuller) Pull(image string) error { image, tag := parseImageName(image) + + // If no tag was specified, use the default "latest". + if len(tag) == 0 { + tag = "latest" + } + opts := docker.PullImageOptions{ Repository: image, Tag: tag, @@ -194,7 +200,7 @@ func parseDockerName(name string) (manifestID, containerName string) { return } -// Parses image name including an tag and returns image name and tag +// Parses image name including a tag and returns image name and tag. // TODO: Future Docker versions can parse the tag on daemon side, see: // https://github.com/dotcloud/docker/issues/6876 // So this can be deprecated at some point.