Merge pull request #29301 from miaoyq/improve-print-info-for-inspect

Improve the error print of image inspect
Upstream-commit: 0ca4995ca8127f64dd82a4b0d67ef17cf5bdb3db
Component: engine
This commit is contained in:
Vincent Demeester
2017-01-24 10:56:24 +01:00
committed by GitHub
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())
}