Skip to content

Instantly share code, notes, and snippets.

@denzhel
Created April 29, 2021 19:41
Show Gist options
  • Select an option

  • Save denzhel/298e3b4761af3760ec7a416525ad3537 to your computer and use it in GitHub Desktop.

Select an option

Save denzhel/298e3b4761af3760ec7a416525ad3537 to your computer and use it in GitHub Desktop.
Query Docker for rate limit

If you're using Docker Hub as a docker registry and using an anonymous account at some point you will hit the rate limit. To know where you stand use this:

IMAGE="ratelimitpreview/test"
TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:$IMAGE:pull" | jq -r .token)
curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/$IMAGE/manifests/latest

This will output:

RateLimit-Limit: 2500;w=21600
RateLimit-Remaining: 2495;w=21600

2500 = How many requests you can do w = The duration in seconds

Credit: https://about.gitlab.com/blog/2020/11/18/docker-hub-rate-limit-monitoring/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment