Skip to content

Commit

Permalink
Fix tag output where image is not found.
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <[email protected]> (github: jfrazelle)
  • Loading branch information
jessfraz committed Nov 20, 2014
1 parent 7a78909 commit e527be1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions api/client/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -2054,15 +2054,16 @@ func (cli *DockerCli) CmdTag(args ...string) error {
}

func (cli *DockerCli) pullImage(image string) error {
return cli.pullImageCustomOut(image, cli.out)
}

func (cli *DockerCli) pullImageCustomOut(image string, out io.Writer) error {
v := url.Values{}
repos, tag := parsers.ParseRepositoryTag(image)
// pull only the image tagged 'latest' if no tag was specified
if tag == "" {
tag = graph.DEFAULTTAG
}
return cli.pullImageCustomOut(repos, tag, cli.out)
}

func (cli *DockerCli) pullImageCustomOut(repos string, tag string, out io.Writer) error {
v := url.Values{}
v.Set("fromImage", repos)
v.Set("tag", tag)

Expand Down Expand Up @@ -2150,14 +2151,14 @@ func (cli *DockerCli) createContainer(config *runconfig.Config, hostConfig *runc
stream, statusCode, err := cli.call("POST", "/containers/create?"+containerValues.Encode(), mergedConfig, false)
//if image not found try to pull it
if statusCode == 404 {
repos, tag := parsers.ParseRepositoryTag(config.Image)
repo, tag := parsers.ParseRepositoryTag(config.Image)
if tag == "" {
tag = graph.DEFAULTTAG
}
fmt.Fprintf(cli.err, "Unable to find image '%s:%s' locally\n", repos, tag)
fmt.Fprintf(cli.err, "Unable to find image '%s:%s' locally\n", repo, tag)

// we don't want to write to stdout anything apart from container.ID
if err = cli.pullImageCustomOut(repos, tag, cli.err); err != nil {
if err = cli.pullImageCustomOut(config.Image, cli.err); err != nil {
return nil, err
}
// Retry
Expand Down

0 comments on commit e527be1

Please sign in to comment.