mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
allow docker run <name>:<id>
This commit is contained in:
parent
a8ae398bf5
commit
d26a3b37a6
1 changed files with 8 additions and 2 deletions
10
tags.go
10
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
|
||||
|
|
Loading…
Reference in a new issue