mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 12:41:42 +00:00
Merge pull request #1054 from nickstenning/getimage-by-tag
* Runtime: Reverse priority of tag lookup in TagStore.GetImage
This commit is contained in:
@@ -204,15 +204,15 @@ func (store *TagStore) GetImage(repoName, tagOrID string) (*Image, error) {
|
||||
} else if repo == nil {
|
||||
return nil, nil
|
||||
}
|
||||
//go through all the tags, to see if tag is in fact an ID
|
||||
if revision, exists := repo[tagOrID]; exists {
|
||||
return store.graph.Get(revision)
|
||||
}
|
||||
// If no matching tag is found, search through images for a matching image id
|
||||
for _, revision := range repo {
|
||||
if strings.HasPrefix(revision, tagOrID) {
|
||||
return store.graph.Get(revision)
|
||||
}
|
||||
}
|
||||
if revision, exists := repo[tagOrID]; exists {
|
||||
return store.graph.Get(revision)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user