Signed-off-by: Lei Jitang <leijitang@huawei.com>
Signed-off-by: Jessica Frazelle <jess@docker.com>
| ... | ... |
@@ -2054,16 +2054,15 @@ func (cli *DockerCli) CmdTag(args ...string) error {
|
| 2054 | 2054 |
} |
| 2055 | 2055 |
|
| 2056 | 2056 |
func (cli *DockerCli) pullImage(image string) error {
|
| 2057 |
- return cli.pullImageCustomOut(image, cli.out) |
|
| 2058 |
-} |
|
| 2059 |
- |
|
| 2060 |
-func (cli *DockerCli) pullImageCustomOut(image string, out io.Writer) error {
|
|
| 2061 |
- v := url.Values{}
|
|
| 2062 | 2057 |
repos, tag := parsers.ParseRepositoryTag(image) |
| 2063 |
- // pull only the image tagged 'latest' if no tag was specified |
|
| 2064 | 2058 |
if tag == "" {
|
| 2065 | 2059 |
tag = graph.DEFAULTTAG |
| 2066 | 2060 |
} |
| 2061 |
+ return cli.pullImageCustomOut(repos, tag, cli.out) |
|
| 2062 |
+} |
|
| 2063 |
+ |
|
| 2064 |
+func (cli *DockerCli) pullImageCustomOut(repos string, tag string, out io.Writer) error {
|
|
| 2065 |
+ v := url.Values{}
|
|
| 2067 | 2066 |
v.Set("fromImage", repos)
|
| 2068 | 2067 |
v.Set("tag", tag)
|
| 2069 | 2068 |
|
| ... | ... |
@@ -2151,10 +2150,14 @@ func (cli *DockerCli) createContainer(config *runconfig.Config, hostConfig *runc |
| 2151 | 2151 |
stream, statusCode, err := cli.call("POST", "/containers/create?"+containerValues.Encode(), mergedConfig, false)
|
| 2152 | 2152 |
//if image not found try to pull it |
| 2153 | 2153 |
if statusCode == 404 {
|
| 2154 |
- fmt.Fprintf(cli.err, "Unable to find image '%s' locally\n", config.Image) |
|
| 2154 |
+ repos, tag := parsers.ParseRepositoryTag(config.Image) |
|
| 2155 |
+ if tag == "" {
|
|
| 2156 |
+ tag = graph.DEFAULTTAG |
|
| 2157 |
+ } |
|
| 2158 |
+ fmt.Fprintf(cli.err, "Unable to find image '%s:%s' locally\n", repos, tag) |
|
| 2155 | 2159 |
|
| 2156 | 2160 |
// we don't want to write to stdout anything apart from container.ID |
| 2157 |
- if err = cli.pullImageCustomOut(config.Image, cli.err); err != nil {
|
|
| 2161 |
+ if err = cli.pullImageCustomOut(repos, tag, cli.err); err != nil {
|
|
| 2158 | 2162 |
return nil, err |
| 2159 | 2163 |
} |
| 2160 | 2164 |
// Retry |