Fix image verification when hostname is present in image

Deal better with the situation where a image name contains
a hostname as well.

Fixes #30580
This commit is contained in:
Davanum Srinivas
2016-08-13 23:09:44 -04:00
parent 8cc31b648e
commit cc9f41c6d3
2 changed files with 22 additions and 3 deletions

View File

@@ -167,11 +167,20 @@ func matchImageTagOrSHA(inspected dockertypes.ImageInspect, image string) bool {
return true
}
if isTagged {
hostname, _ := dockerref.SplitHostname(named)
// Check the RepoTags for an exact match
for _, tag := range inspected.RepoTags {
if tag == image {
// We found a specific tag that we were looking for
return true
// Deal with image with hostname specified
if len(hostname) > 0 {
if strings.HasSuffix(image, tag) {
return true
}
} else {
if tag == image {
// We found a specific tag that we were looking for
return true
}
}
}
}