You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
imageID:="sha256:0505a58fa4646ca8c19699d99a1053c789d00d9424ee9d8ed4d988e7642d1672"name, err:=name.ParseReference(imageID)
// err is nil, name is a tagregistry:=name.Context().RegistryStr()
// "index.docker.io"repo:=name.Context().RepositoryStr()
// "library/sha256"tag:=name.Context().Tag(name.Identifier()).TagStr()
// "0505a58fa4646ca8c19699d99a1053c789d00d9424ee9d8ed4d988e7642d1672"
The "Image ID" is a validlocal image reference that can be run with docker run, but not something we can pull from a registry, because it's neither a tag or digest.
📃 Click for more details demonstrating the difference between "Image ID", "Image Digest", and "Image Tag".
We have an ubuntu:latest image pulled, with sha256:77906da… as the (remote) image digest, and sha256:2b7cc08… as the local image ID.
$ docker images --digests --no-truncREPOSITORY TAG DIGEST IMAGE ID CREATED SIZEubuntu latest sha256:77906da… sha256:2b7cc08… 2 months ago 69.2MB…
We can run our ubuntu:latest image by specifying the same digest we have locally:
$ docker run --rm -it ubuntu@sha256:77906da…root@69a36beaf024:/# exit
Of course, we cannot specify that image ID as the digest, because it's not the same thing:
$ docker run --rm -it ubuntu@sha256:2b7cc08…Unable to find image 'sha256:2b7cc08…' locallydocker: Error response from daemon: manifest for ubuntu@sha256:2b7cc08… not found: manifest unknown: manifest unknown.See 'docker run --help'.
We can specify just the Image ID of our local ubuntu:latest:
$ docker run --rm -it sha256:2b7cc08… root@c29f22dc1dd9:/# exit
Then, just for fun, we can't specify just the digest, because the daemon won't know which image you're referring to:
$ docker run --rm -it sha256:77906da…docker: Error response from daemon: No such image: sha256:77906da…See 'docker run --help'.
The text was updated successfully, but these errors were encountered:
Describe the bug
The
name.ParseReference
function treats a local "Image ID" reference as aname.Tag
, instead of returning anerror
.To Reproduce
Expected behavior
I would expect
name.ParseReference
to return an error.Additional context
The "Image ID" is a valid local image reference that can be run with
docker run
, but not something we can pull from a registry, because it's neither a tag or digest.📃 Click for more details demonstrating the difference between "Image ID", "Image Digest", and "Image Tag".
We have an
ubuntu:latest
image pulled, withsha256:77906da…
as the (remote) image digest, andsha256:2b7cc08…
as the local image ID.We can run our
ubuntu:latest
image by specifying the same digest we have locally:Of course, we cannot specify that image ID as the digest, because it's not the same thing:
We can specify just the Image ID of our local
ubuntu:latest
:Then, just for fun, we can't specify just the digest, because the daemon won't know which image you're referring to:
The text was updated successfully, but these errors were encountered: