-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Ambiguity in the ImageCreate API when pulling a tag or digest #21793
Comments
cc @thaJeztah do you know what the behavior is for these scenarios? |
Yeah, it's a bit confusing for sure (most of this was for backward compatibility, but we do want to ultimately add an explicit "all-tags" option instead of the implicit behavior when tag is empty, see moby/moby#42053 and moby/moby#48760). Any The logic to decide whether all tags should be pulled is based on the value of the |
OK, thanks 👍🏻
I think in that case, "The name may include a tag or digest" is indeed misleading. Should probably read something along the lines of: "If the name includes a tag or digest, it is ignored. Use the |
Hmm... while looking at your docs PR; I actually think I'm wrong; it's ignored a I guess we tried to avoid accidentally pulling "all tags". # pulls latest
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn:latest'
# pulls "0.1.0" tag
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn:0.1.0'
# tag query parameter takes precedence; pulls "0.1.0" tag
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn:0.1&tag=0.1.0'
# no tag in "fromImage" AND no tag in "tag" parameter; pulls all tags
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn' For digests.. it looks like there's some inconsistency; specifying the digest in # pulls by digest
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn@sha256:641f09e6a0409cc0a9f98e943dd033aa3b914d9141174c39bc0d00cb9519e07b'
# tag + digest in "fromImage"; tag resolution is skipped and image is pulled by digest
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn:0.1.0@sha256:641f09e6a0409cc0a9f98e943dd033aa3b914d9141174c39bc0d00cb9519e07b' This seems inconsistent though; if curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn@sha256:641f09e6a0409cc0a9f98e943dd033aa3b914d9141174c39bc0d00cb9519e07b&tag=0.1.0'
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn:0.1@sha256:641f09e6a0409cc0a9f98e943dd033aa3b914d9141174c39bc0d00cb9519e07b&tag=0.1.0' Passing a tag in curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn:latest&tag=sha256:641f09e6a0409cc0a9f98e943dd033aa3b914d9141174c39bc0d00cb9519e07b' Passing an incorrect digest through curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn@sha256:641f09e6a0409cc0a9f98e943dd033aa3b914d9141174c39bc0d00cb9519e07b&tag=sha256:3A2919d0172f7524b2d8df9e50066a682669e6d170ac0f6a49676d54358fe970b5'
{"message":"invalid tag format"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.47/images/create?fromImage=thajeztah/angry-unicorn:latest&tag=sha256:3A2919d0172f7524b2d8df9e50066a682669e6d170ac0f6a49676d54358fe970b5'
{"message":"invalid tag format"} |
Assuming I understood you correctly, you are saying that:
In short, so long as we make sure to specify a tag or a digest in |
Is this a docs issue?
Type of issue
Other
Description
There is a bit of an ambiguity in the way that https://docs.docker.com/reference/api/engine/version/v1.47/#tag/Image/operation/ImageCreate is specified.
On the one hand, it says that
fromImage
may include a tag or a digest to pull. On the other hand, it says that iftag
is empty then all tags for the given image will be pulled.tag
query parameter equivalent to sending the parameter with an empty value?fromImage
buttag
is omitted? Will the specific tag or digest get pulled? Or will all the tags get pulled?fromImage
but a different tag in thetag
property?Location
https://docs.docker.com/reference/api/engine/version/v1.47/#tag/Image/operation/ImageCreate
Suggestion
Please clarify the above scenarios in the API documentation
The text was updated successfully, but these errors were encountered: