Merge pull request #15807 from coolljt0725/remove_remove_redundant_tag_name

Minor fix: remove redundant tag name in error message of create failed.
Upstream-commit: 754c10430b1d0e6247e2cdd150bc15291ff87de0
Component: engine
This commit is contained in:
Brian Goff
2015-08-31 11:34:40 -04:00
2 changed files with 44 additions and 2 deletions
+6 -2
View File
@@ -2,6 +2,7 @@ package daemon
import (
"fmt"
"strings"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/api/types"
@@ -28,11 +29,14 @@ func (daemon *Daemon) ContainerCreate(name string, config *runconfig.Config, hos
container, buildWarnings, err := daemon.Create(config, hostConfig, name)
if err != nil {
if daemon.Graph().IsNotExist(err, config.Image) {
_, tag := parsers.ParseRepositoryTag(config.Image)
if strings.Contains(config.Image, "@") {
return nil, warnings, fmt.Errorf("No such image: %s", config.Image)
}
img, tag := parsers.ParseRepositoryTag(config.Image)
if tag == "" {
tag = tags.DefaultTag
}
return nil, warnings, fmt.Errorf("No such image: %s (tag: %s)", config.Image, tag)
return nil, warnings, fmt.Errorf("No such image: %s:%s", img, tag)
}
return nil, warnings, err
}