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

Support for multi-arch docker images on size badge #8238

Closed
sh-cho opened this issue Jul 23, 2022 · 3 comments
Closed

Support for multi-arch docker images on size badge #8238

sh-cho opened this issue Jul 23, 2022 · 3 comments
Labels
good first issue New contributors, join in! service-badge New or updated service badge

Comments

@sh-cho
Copy link

sh-cho commented Jul 23, 2022

📋 Description

![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/_/mysql/latest)

Docker Image Size (latest by date)

For example, mysql:latest image supports ["linux/amd64", "linux/arm64/v8"] os/architecture, but looks like I can't choose which one to use in the badge.

Is there any way to specify docker image's platform?

I can see docker version badge is available to select architecture with &arch=.. parameter.

@sh-cho sh-cho changed the title Support for multi-arch docker images Support for multi-arch docker images on size badge Jul 23, 2022
@chris48s
Copy link
Member

For the docker image size badge, we don't have an arch param and we also don't explicitly make an assumption about architecture. We just report the value of full_size, so if we look at

https://registry.hub.docker.com/v2/repositories/library/mysql/tags/latest

{
  "creator": 7,
  "id": 20021,
  "images": [
    {
      "architecture": "amd64",
      "features": "",
      "variant": null,
      "digest": "sha256:44f98f4dd825a945d2a6a4b7b2f14127b5d07c5aaa07d9d232c2b58936fb76dc",
      "os": "linux",
      "os_features": "",
      "os_version": null,
      "size": 131789857,
      "status": "active",
      "last_pulled": "2022-07-23T14:07:03.54267Z",
      "last_pushed": "2022-07-13T07:05:12.182358Z"
    },
    {
      "architecture": "arm64",
      "features": "",
      "variant": "v8",
      "digest": "sha256:12cf01a51f803d0ad49ee0dbbb3025a6eef3341e24757c2ed8150b6654c3fb07",
      "os": "linux",
      "os_features": "",
      "os_version": null,
      "size": 138716495,
      "status": "active",
      "last_pulled": "2022-07-23T08:20:42.387497Z",
      "last_pushed": "2022-07-13T08:05:31.345335Z"
    }
  ],
  "last_updated": "2022-07-13T08:05:52.466381Z",
  "last_updater": 1156886,
  "last_updater_username": "doijanky",
  "name": "latest",
  "repository": 21179,
  "full_size": 131789857,
  "v2": true,
  "tag_status": "active",
  "tag_last_pulled": "2022-07-23T14:07:03.54267Z",
  "tag_last_pushed": "2022-07-13T08:05:52.466381Z"
}

It looks like full_size in this case is the size of the amd64 image, but I'm not 100% sure what the rule is for how the API decides which image size to report there.

I think it would be reasonable to add an arch param to this endpoint, but if it is not specified, we just report the value of full_size (deferring to the DockerHub API's rules for deciding which image is the "default") if it is not specified.

@chris48s chris48s added good first issue New contributors, join in! service-badge New or updated service badge labels Jul 23, 2022
@PaulaBarszcz
Copy link
Collaborator

I would like to work on this :)

@chris48s
Copy link
Member

Cool - the post above should contain all the info. You can also have a look at the docker versions badge for some pointers (although this one should be a bit more straightforward!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue New contributors, join in! service-badge New or updated service badge
Projects
None yet
Development

No branches or pull requests

3 participants