1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Improve the error print of image inspect

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
This commit is contained in:
Yanqiang Miao 2016-12-10 16:03:38 +08:00
parent 929ae4a0b6
commit cc9ed0a31b
2 changed files with 3 additions and 3 deletions

View file

@ -1,12 +1,12 @@
package daemon package daemon
import ( import (
"fmt"
"time" "time"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/layer" "github.com/docker/docker/layer"
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/pkg/errors"
) )
// LookupImage looks up an image by name and returns it as an ImageInspect // LookupImage looks up an image by name and returns it as an ImageInspect
@ -14,7 +14,7 @@ import (
func (daemon *Daemon) LookupImage(name string) (*types.ImageInspect, error) { func (daemon *Daemon) LookupImage(name string) (*types.ImageInspect, error) {
img, err := daemon.GetImage(name) img, err := daemon.GetImage(name)
if err != nil { if err != nil {
return nil, fmt.Errorf("No such image: %s", name) return nil, errors.Wrapf(err, "no such image: %s", name)
} }
refs := daemon.referenceStore.References(img.ID().Digest()) refs := daemon.referenceStore.References(img.ID().Digest())

View file

@ -761,7 +761,7 @@ func WaitInspectWithArgs(dockerBinary, name, expr, expected string, timeout time
for { for {
result := icmd.RunCommand(dockerBinary, args...) result := icmd.RunCommand(dockerBinary, args...)
if result.Error != nil { if result.Error != nil {
if !strings.Contains(result.Stderr(), "No such") { if !strings.Contains(strings.ToLower(result.Stderr()), "no such") {
return errors.Errorf("error executing docker inspect: %v\n%s", return errors.Errorf("error executing docker inspect: %v\n%s",
result.Stderr(), result.Stdout()) result.Stderr(), result.Stdout())
} }