badgen.net icon indicating copy to clipboard operation
badgen.net copied to clipboard

Add badge for docker image meta

Open styfle opened this issue 7 years ago • 9 comments

microbadger.com shows the size, number of layers, and version of a docker image.

image

It would be nice if badgen could support this service (I am not sure if an API is available).

https://images.microbadger.com/badges/image/node.svg https://images.microbadger.com/badges/image/elasticsearch:2.3.1.svg https://images.microbadger.com/badges/image/mhart/alpine-node:base-10.12.0.svg

styfle avatar Oct 29 '18 14:10 styfle

I found the API ✨

https://api.microbadger.com/v1/images/node https://api.microbadger.com/v1/images/elasticsearch https://api.microbadger.com/v1/images/mhart/alpine-node

It's just super slow 🤷‍♂️

styfle avatar Oct 29 '18 14:10 styfle

Indeed it's extremely slow 🤦‍♂️

amio avatar Oct 30 '18 03:10 amio

Badgen's requests would timeout at 3 seconds (to make sure response for GitHub before it's timeout). We need to find a faster api for this, maybe official docker hub api or some other handy alternative. Or help them speed up this. A simple CDN cache would do the work.

amio avatar Oct 31 '18 02:10 amio

I looked at the official docker hub api but it doesn't seem to aggregate the sum of the layers. You might be able to get each layer individually with several api calls and then perform the sum yourself.

That's basically what package phobia does for npm...but even npm isn't interested in adding this feature to their registry. So docker will likely avoid this too 😞

styfle avatar Oct 31 '18 13:10 styfle

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 30 '18 14:11 stale[bot]

Should we keep this issue open? I think the idea of image size as a badge is relevant, even if it doesn't come from microbadger service.

styfle avatar Nov 30 '18 14:11 styfle

@styfle Sure

amio avatar Dec 02 '18 06:12 amio

Seems we can get layers info from official registry api https://docs.docker.com/registry/spec/api/#pulling-an-image

While I hate to add another token 😾

amio avatar Jul 16 '19 03:07 amio

Support for the docker build status similar to shield.io would be useful as well https://img.shields.io/docker/build/vuejs/ci

image

paolomolo avatar Apr 24 '20 12:04 paolomolo