-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker pull with bad tag pulls by digest #22112
Comments
This isn't the pull-by-digest case that uses |
the |
ping @bainsy88 |
@thaJeztah Maybe you can comment on the docs side? This may have been something that we decided not to promote anymore but never deprecated in the code. |
Hm, I'm actually not aware of the "repo:shortid" notation, so sounds like a bug to me |
I'll label as a bug, but possibly someone knows if there's indeed some historic format that I'm not aware of |
given we now support the |
oh! docker 0.4.1 - just before I started using it. I'm +1 to deprecating it, in favor of the new notation |
+1 for deprecating, the particularly nasty scenario the current behavior exposes is as follows: User/script tries to run animage:45 which is expected to be on a host. Tag 45 isn't actually there and animage:22, by coincidence, has an image id starting 45, this will result in the run succeeding but launching a different tag of the image than the user expects. Above may sound unlikely given the random IDs but I have seen it happen a couple of times. |
@duglin want to work on this? |
Perhaps, but I'd like confirmation from the other maintainers that this change in direction is what people want first. |
ping @aaronlehmann @stevvooe any objections against this change? |
I support deprecating the |
Same here, it doesn't even seems to be documented so.. 👼 |
to be clear... are we removing |
I would prefer to remove both. I don't see the value of |
@aaronlehmann I agree but wanted to make sure I wasn't alone in the thinking :-) |
Same for me; SGTM |
SGTM I was not aware of this behavior. If we did "short id" lookup, it should be on the other side of |
going to have to do this in stages since we need to deprecate it first before we remove it, but does this sound right to people:
So the generic form is:
@stevvooe I wasn't sure if you wanted to totally ban the inclusion of the |
@duglin The current behavior is erroneous and undocumented. It should be fixed before exploring other options. I was merely commenting that if we did have repo-qualified, short id lookup, it would be something like |
I think there is still a bug here. The inspect on an image gives an Id that doesn't seem to be valid. For example when I look to try and reference the sha256 of the redis image I can't pull the same exact image that I have locally:
Though with some further inspections it seems that I might also have the
As an aside: If it's unknown why one would want to have this ability, I'll try and explain a use case. Say a build system uses the If I we able to render out the a |
Yes. The bug here is that the The main issue here is that we don't save the gzipped layers between pushes. These do get fixed at push, which creates tar-split files, at which time the remote digest can be calculated. Perhaps, the solution here is to have the ability to generate the remote digest without actually pushing. This would go through the process of compressing the layers and saving the tar-split files to fix the remote hash. |
Given two images:
When I do
docker run dug:v1
anddocker run dug:v2
the correct images are found/used.However, if instead of the image tag I used a portion of the image ID then instead of failing it works.
For example:
docker run dug:9f1
will rundug:v1
instead of saying it can't find an image with tag9f1
.In looking at the docs ( https://docs.docker.com/engine/reference/commandline/pull/#pull-an-image-by-digest-immutable-identifier ) it talks about pulling image by digest but only shows examples of the syntax:
ubuntu@sha256:45b23dee08af5e43a
- notice the@sha256
in there.It seems that docker shouldn't assume a "tag" is a "digest" unless it also includes the "sha256" portion.
I believe this is happening due to the code here: https://github.com/docker/docker/blob/master/daemon/daemon.go#L1150 - it shouldn't be calling
daemon.imageStore.Search(tagged.Tag())
.However, if this is the expected behavior then we should update the docs to let people know that "tags" will be treated as "image IDs" because this isn't what I was expecting.
ping @tonistiigi
The text was updated successfully, but these errors were encountered: