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
import (
"fmt"
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/layer"
"github.com/docker/docker/reference"
"github.com/pkg/errors"
)
// 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) {
img, err := daemon.GetImage(name)
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())

View File

@ -761,7 +761,7 @@ func WaitInspectWithArgs(dockerBinary, name, expr, expected string, timeout time
for {
result := icmd.RunCommand(dockerBinary, args...)
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",
result.Stderr(), result.Stdout())
}