Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

Commit e7b7922

Browse files
committed
Allow images to be run using their hash value
Use "docker inspect" instead of "docker images".
1 parent 58b5566 commit e7b7922

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/src/docker/docker.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ func InspectVolume(name string) (string, error) {
110110
}
111111

112112
func ImageExists(image string) (bool, error) {
113-
b, err := docker(false, "images", "-q", image)
114-
if err != nil || len(b) == 0 {
115-
return false, err
113+
_, err := docker(false, "inspect", "--type=image", image)
114+
if err != nil {
115+
// We can't know whether the image was missing or if the daemon was unreachable.
116+
return false, nil
116117
}
118+
117119
return true, nil
118120
}
119121

0 commit comments

Comments
 (0)