Browse code

Merge pull request #9270 from jfrazelle/8919-tag-output

Output image with tag name when image is not found

unclejack authored on 2014/11/22 08:56:31
Showing 1 changed files
... ...
@@ -2158,7 +2158,11 @@ func (cli *DockerCli) createContainer(config *runconfig.Config, hostConfig *runc
2158 2158
 	stream, statusCode, err := cli.call("POST", "/containers/create?"+containerValues.Encode(), mergedConfig, false)
2159 2159
 	//if image not found try to pull it
2160 2160
 	if statusCode == 404 {
2161
-		fmt.Fprintf(cli.err, "Unable to find image '%s' locally\n", config.Image)
2161
+		repo, tag := parsers.ParseRepositoryTag(config.Image)
2162
+		if tag == "" {
2163
+			tag = graph.DEFAULTTAG
2164
+		}
2165
+		fmt.Fprintf(cli.err, "Unable to find image '%s:%s' locally\n", repo, tag)
2162 2166
 
2163 2167
 		// we don't want to write to stdout anything apart from container.ID
2164 2168
 		if err = cli.pullImageCustomOut(config.Image, cli.err); err != nil {