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

Incorrect image size for Docker Hub #9703

Open
Feriman22 opened this issue Nov 1, 2023 · 4 comments · May be fixed by #10547
Open

Incorrect image size for Docker Hub #9703

Feriman22 opened this issue Nov 1, 2023 · 4 comments · May be fixed by #10547
Labels
service-badge New or updated service badge

Comments

@Feriman22
Copy link

Are you experiencing an issue with...

shields.io

🐞 Description

The Docker Image Size badge displays an incorrect size of a Docker Image. In the example, the badge shows 4.21MB, but the size of the latest version is only 4.02MB.

image

image

🔗 Link to the badge

Docker Image Size

💡 Possible Solution

No response

@Feriman22 Feriman22 added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label Nov 1, 2023
@calebcartwright
Copy link
Member

Haven't looked closely at the API response from Docker Hub, but suspect this is just Mebibytes vs. Megabytes

@Feriman22
Copy link
Author

Yes, it's possible. However, the badge should show the same value as on the Docker Hub.

@chris48s
Copy link
Member

chris48s commented Nov 1, 2023

Yes it is that. The size of the image is reported in bytes via the DockerHub API. This image is 4210627 bytes

4210627/1024/1024 = 4.015...
4210627/1000/1000 = 4.210...

In general, we use https://github.com/sindresorhus/pretty-bytes#pretty-bytes for formatting, which uses kilobytes. I think if someone wants to add a kibibytes formatter which can be used for size badges where the upstream convention is to report kibibytes, we can take a look at a PR.

@chris48s chris48s added service-badge New or updated service badge and removed question Support questions, usage questions, unconfirmed bugs, discussions, ideas labels Nov 1, 2023
@calebcartwright
Copy link
Member

I agree it would be good for us to support this, though I'd prefer that we do so via providing conditional support to give users control. That's because this is an instance where I think we should try to be consistent across our own ecosystem by default and not trying to match what upstream services do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
3 participants