Skip to content
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

Bug: Link to Docker Hub gets confused when image is hash-pinned #4056

Closed
pnacht opened this issue Sep 4, 2023 · 6 comments · Fixed by #4065
Closed

Bug: Link to Docker Hub gets confused when image is hash-pinned #4056

pnacht opened this issue Sep 4, 2023 · 6 comments · Fixed by #4065

Comments

@pnacht
Copy link

pnacht commented Sep 4, 2023

When I write a FROM command, a Docker Hub link is automatically created pointing to the image.

FROM cirrusci/windowsservercore:2019

Clicking on the underlined section in the image above, for example, takes me to https://hub.docker.com/r/cirrusci/windowsservercore/.

However, if I decide to hash-pin the image, the parser seems to get confused:

Screenshot 2023-09-04 at 13 56 21

We can see the underlined section has moved, and the link now takes me to https://hub.docker.com/_/windowsservercore:2019/, which 404's.

Hash-pinning without the tag works correctly, as before:

Screenshot 2023-09-04 at 13 56 03

@bwateratmsft
Copy link
Collaborator

@rcjsuen can you look at this? Thanks!

@bwateratmsft bwateratmsft added this to the 1.28.0 milestone Sep 6, 2023
@rcjsuen
Copy link
Contributor

rcjsuen commented Sep 8, 2023

I did not know this was possible as I assumed it was either a tag or a digest. Perhaps the definition of "digest" is looser than I expected.

@pnacht Would you happen to have a link to some official definition of "digest"?

@pnacht
Copy link
Author

pnacht commented Sep 8, 2023

Not really, but I'm fairly certain it's precisely what you think it is.

Docker allows using both a tag and a digest, but that effectively turns the tag into a "comment".

When docker actually goes to fetch the image, it'll only care about the digest. It won't even validate that the tag exists. But having the tag there makes it easier for humans to understand what exactly is being fetched, and it gives automated tools such as dependabot a better idea of what to track.

@rcjsuen
Copy link
Contributor

rcjsuen commented Sep 9, 2023

Docker allows using both a tag and a digest, but that effectively turns the tag into a "comment".

FROM [--platform=<platform>] <image> [AS <name>]
FROM [--platform=<platform>] <image>[:<tag>] [AS <name>]
FROM [--platform=<platform>] <image>[@<digest>] [AS <name>]

The documentation mentions the three forms above. I wonder why it does not mention this "fourth" form which is the format in your file.

FROM [--platform=<platform>] <image>[:<tag>][@<digest>] [AS <name>]

As it is right now your example does not conform to any of the three forms but perhaps that is just an oversight that was missed in the documentation.

@rcjsuen
Copy link
Contributor

rcjsuen commented Sep 10, 2023

The parser will have to be updated to handle this. I have opened rcjsuen/dockerfile-ast#112 to track this.

@pnacht
Copy link
Author

pnacht commented Sep 11, 2023

As it is right now your example does not conform to any of the three forms but perhaps that is just an oversight that was missed in the documentation.

Good point! I've opened docker/docs#18157 to track this.

@alexyaang alexyaang modified the milestones: 1.28.0, 1.27.0 Sep 19, 2023
@microsoft microsoft locked and limited conversation to collaborators Nov 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants