I had to gather statistics for my team’s repo. Here is a small recipe to get the pull count for a specific repository .
- Setup the Bearer Token.
export DOCKER_USERNAME="prb112"
export DOCKER_PASSWORD="<<>>"
export TOKEN=$(curl -s -H "Content-Type: application/json" \
-X POST -d '{"username": "'${DOCKER_USERNAME}'", "password": "'${DOCKER_PASSWORD}'"}' \
https://hub.docker.com/v2/users/login/ | jq -r .token)
- Pull the stats:
curl -L -H "Authorization: Bearer $TOKEN" \
https://hub.docker.com/v2/repositories/ibmcom/ibm-fhir-server \
| jq -r '.pull_count'
574725
Thanks to Arthur Koziel’s Blog