mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Show tag used when image is missing
This commit is contained in:
parent
1843a71911
commit
07a887032a
2 changed files with 14 additions and 1 deletions
|
@ -1402,6 +1402,13 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
||||||
body, statusCode, err := cli.call("POST", "/containers/create", config)
|
body, statusCode, err := cli.call("POST", "/containers/create", config)
|
||||||
//if image not found try to pull it
|
//if image not found try to pull it
|
||||||
if statusCode == 404 {
|
if statusCode == 404 {
|
||||||
|
_, tag := utils.ParseRepositoryTag(config.Image)
|
||||||
|
if tag == "" {
|
||||||
|
tag = DEFAULTTAG
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Unable to find image '%s' (tag: %s) locally\n", config.Image, tag)
|
||||||
|
|
||||||
v := url.Values{}
|
v := url.Values{}
|
||||||
repos, tag := utils.ParseRepositoryTag(config.Image)
|
repos, tag := utils.ParseRepositoryTag(config.Image)
|
||||||
v.Set("fromImage", repos)
|
v.Set("fromImage", repos)
|
||||||
|
|
|
@ -828,7 +828,13 @@ func (srv *Server) ContainerCreate(config *Config) (string, error) {
|
||||||
container, err := b.Create(config)
|
container, err := b.Create(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if srv.runtime.graph.IsNotExist(err) {
|
if srv.runtime.graph.IsNotExist(err) {
|
||||||
return "", fmt.Errorf("No such image: %s", config.Image)
|
|
||||||
|
_, tag := utils.ParseRepositoryTag(config.Image)
|
||||||
|
if tag == "" {
|
||||||
|
tag = DEFAULTTAG
|
||||||
|
}
|
||||||
|
|
||||||
|
return "", fmt.Errorf("No such image: %s (tag: %s)", config.Image, tag)
|
||||||
}
|
}
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue