Fix error from daemon no such image even when the image exist

Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
Lei Jitang
2015-03-28 09:07:20 +08:00
parent 789a67e931
commit 013fb87543
6 changed files with 18 additions and 6 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"io"
"net/url"
"os"
"strings"
"github.com/docker/docker/api/types"
"github.com/docker/docker/graph"
@@ -94,7 +95,7 @@ func (cli *DockerCli) createContainer(config *runconfig.Config, hostConfig *runc
//create the container
stream, statusCode, err := cli.call("POST", "/containers/create?"+containerValues.Encode(), mergedConfig, nil)
//if image not found try to pull it
if statusCode == 404 {
if statusCode == 404 && strings.Contains(err.Error(), config.Image) {
repo, tag := parsers.ParseRepositoryTag(config.Image)
if tag == "" {
tag = graph.DEFAULTTAG