MicroBadger — keep your metadata fresh with a webhook
Docker labels are a powerful feature that allows you to add metadata to your Docker images. MicroBadger is our tool for managing container metadata. By adding labels you can link your image to the source code commit it was built against, or the software license it’s released under. We also give you badges you can add to your GitHub readme or Docker Hub notes.
Metadata is powerful but stale metadata is a problem. For MicroBadger we refresh all the metadata once a day. But if you’ve pushed a new image that’s a long time to wait for your data to refresh. We wanted to do better than that, so we built a webhook you can call.
Webhooks are HTTP callbacks that are triggered by an event. The calling site simply makes an HTTP POST request to the webhook URL. Docker Hub has a push webhook that is called whenever a new version of an image is pushed, and this post shows you how to set that up to trigger a metadata refresh on MicroBadger. Our webhook will also work with any other system that supports them, such as your CI system.
Get the webhook
To get your webhook visit your image on MicroBadger. Scroll down and click the “Get the webhook” button and copy your webhook URL.
Add to Docker Hub
Now visit your image on Docker Hub. You’ll need to be signed in and a maintainer of the image. Click the Webhooks link.
Give the webhook a name and paste the URL.
Hit the Save button. Now whenever you push a new image it will trigger MicroBadger to refresh your metadata.
Get the badges
While you’re on Docker Hub you could also add some badges for your image.
You can get the badges markdown by clicking the “Get the badges” button on MicroBadger.
Please hit the Recommend button below if you found this article interesting or helpful, so that others might be more likely to find it.
Check out MicroBadger to explore image metadata, and follow Microscaling Systems on Twitter.