Docker Community Forums

Share and learn in the Docker community.

API to read the pull counter

dockerhub

#1

Hi,

the pull counter for one of our repository shows 10K+ on the web page. How can we query an API to read the exact count value? If possible, we’d like to query and push this information to a time series DB.

Many thanks


(Gary Forghetti) #2

Try this curl command below. It also requires the jq command.
Change the text xxxxxxxx to your Docker Hub user.
Change the text yyyyyyyy to your Docker repository name.

curl -s https://hub.docker.com/v2/repositories/**xxxxxxxx**/**yyyyyyyy**/ | jq -r '.pull_count' | xargs printf "%'d\n"

Example for the Docker Official Ubuntu image:

curl -s https://hub.docker.com/v2/repositories/library/ubuntu/ | jq -r '.pull_count' | xargs printf "%'d\n"
905,293,446