From d26a3b37a6a8d42b9e7cb7486b928170c43e052e Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Mon, 3 Jun 2013 20:00:15 +0000 Subject: [PATCH] allow docker run : --- tags.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tags.go b/tags.go index 5bc2978e09..140182890d 100644 --- a/tags.go +++ b/tags.go @@ -151,14 +151,20 @@ func (store *TagStore) Get(repoName string) (Repository, error) { return nil, nil } -func (store *TagStore) GetImage(repoName, tag string) (*Image, error) { +func (store *TagStore) GetImage(repoName, tagOrId string) (*Image, error) { repo, err := store.Get(repoName) if err != nil { return nil, err } else if repo == nil { return nil, nil } - if revision, exists := repo[tag]; exists { + //go through all the tags, to see if tag is in fact an ID + for _, revision := range repo { + if utils.TruncateId(revision) == tagOrId { + return store.graph.Get(revision) + } + } + if revision, exists := repo[tagOrId]; exists { return store.graph.Get(revision) } return nil, nil