Oh no! My Travis build is broken!
The dreaded red cross has appeared on your build, but this time, the build has errored with this message:
ERROR: toomanyrequests: You have reached your pull rate limit. You
may increase the limit by authenticating and upgrading:
https://www.docker.com/increase-rate-limit
Recently, Docker introduced a download rate limit on pull requests. What this means is, a user or IP address can pull a Docker image from Docker hub a limited number of times.
For an anonymous user, that’s 100 pulls per 6 hours per IP address. Quite generous you would think. But what if, like us at AddressFinder, you are using an integration service like Travis CI?
Travis pulls the docker image from one of a few IP addresses and given the number of Travis users, the 100 pulls per 6 hours limit is easily reached.
OK, thanks for that, but what I really want to know is how to fix my problem
Sure thing! It’s actually quite easy! You’ll need to do three things:
- Create an account on Docker Hub (the free account will allow up to 200 container image requests per 6 hours).
- Go to your Travis settings on GitHub or Bitbucket and add your new DOCKER_PASSWORD and DOCKER_USERNAME to the environment variables. (Go to More Options > Settings.)
- Insert the following line to your travis.yml file, before running any of your docker commands:
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
And you’re done! Restart your Travis build and you should get that nice green tick we all love to see.
Here’s some further reading if you’d like to know more: