integration cli: add imageExists to docker utils
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
parent
fef1e0a708
commit
eb1e8e884d
1 changed files with 9 additions and 0 deletions
|
@ -66,6 +66,15 @@ func deleteImages(images string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func imageExists(image string) error {
|
||||
inspectCmd := exec.Command(dockerBinary, "inspect", image)
|
||||
exitCode, err := runCommand(inspectCmd)
|
||||
if exitCode != 0 && err == nil {
|
||||
err = fmt.Errorf("couldn't find image '%s'", image)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func cmd(t *testing.T, args ...string) (string, int, error) {
|
||||
out, status, err := runCommandWithOutput(exec.Command(dockerBinary, args...))
|
||||
errorOut(err, t, fmt.Sprintf("'%s' failed with errors: %v (%v)", strings.Join(args, " "), err, out))
|
||||
|
|
Loading…
Reference in a new issue