Docker image statistics from hub.docker.com

Viewed 4302

I have a docker image on hub.docker.com. Is there a way to find out who is using my docker image or who is pulling it? Any statistics that hub.docker.com can provide.

3 Answers

You can get the total pull count and star count from the API:

https://hub.docker.com/v2/repositories/$1/$2

For example:

curl -s https://hub.docker.com/v2/repositories/library/ubuntu/ | jq -r ".pull_count"

Only the statistics about number of pulls can be retrieved, at the moment. Then you can use Google Apps Script to record the number of pulls periodically and store it in a google sheet. You can find more about that here https://www.gasimof.com/blog/track_docker_image_pulls

Since the Docker Hub does not have an out-of-the-box way to see the pull trend, I end up implementing a Prometheus exporter for myself and add a dashboard in my Grafana.

Below is the graph from PromQL: docker_hub_pulls{repo="$repo"}.

Docker Pulls

Here is the Github link to my project: predatorray/docker-hub-prometheus-exporter.

Related