From 5fc71599a0b77189f0fedf629ed43c7f7067956c Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Thu, 6 Oct 2016 17:12:17 -0700 Subject: [PATCH] Deprecate repo:shortid syntax Signed-off-by: Tonis Tiigi --- daemon/image.go | 13 +++++++++---- docs/deprecated.md | 7 +++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/daemon/image.go b/daemon/image.go index b7e5f07269..32a8d77432 100644 --- a/daemon/image.go +++ b/daemon/image.go @@ -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" ) @@ -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 + } } } } diff --git a/docs/deprecated.md b/docs/deprecated.md index e7a301aa27..a591880ef0 100644 --- a/docs/deprecated.md +++ b/docs/deprecated.md @@ -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/)**