Skip to content

Commit

Permalink
Merge pull request #27207 from tonistiigi/deprecate-repo-shortid
Browse files Browse the repository at this point in the history
Deprecate repo:shortid syntax
  • Loading branch information
thaJeztah authored Oct 13, 2016
2 parents 8658748 + 5fc7159 commit 0542dcc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 9 additions & 4 deletions daemon/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/docker/docker/builder"
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/reference"
)

Expand Down Expand Up @@ -34,11 +35,15 @@ func (daemon *Daemon) GetImageID(refOrID string) (image.ID, error) {
if id, err := daemon.referenceStore.Get(ref); err == nil {
return image.IDFromDigest(id), nil
}

// deprecated: repo:shortid https://github.com/docker/docker/pull/799
if tagged, ok := ref.(reference.NamedTagged); ok {
if id, err := daemon.imageStore.Search(tagged.Tag()); err == nil {
for _, namedRef := range daemon.referenceStore.References(id.Digest()) {
if namedRef.Name() == ref.Name() {
return id, nil
if tag := tagged.Tag(); stringid.IsShortID(stringid.TruncateID(tag)) {
if id, err := daemon.imageStore.Search(tag); err == nil {
for _, namedRef := range daemon.referenceStore.References(id.Digest()) {
if namedRef.Name() == ref.Name() {
return id, nil
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions docs/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ To learn more about Docker Engine's deprecation policy,
see [Feature Deprecation Policy](index.md#feature-deprecation-policy).


### `repository:shortid` image references
**Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/)**

**Target For Removal In Release: v1.16**

`repository:shortid` syntax for referencing images is very little used, collides with with tag references can be confused with digest references.

### `docker daemon` subcommand
**Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/)**

Expand Down

0 comments on commit 0542dcc

Please sign in to comment.