Recently, we had one of our pipelines fail at the build stage because of the below 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”.
We noticed the build failed on the docker build stage when it was attempting to pull the Docker File Base Image from Docker Hub. See below.
This article explains how to resolve such an error. The article is assuming we are using the AWS Cloud Platform.
- An AWS Account.
- Created a User on the account with Permissions to provision resources on the account and Access to CloudWatch.
- An ECR Registry.
Pull the Image from Docker Hub and Push it to your Local Registry
Use the below commands to pull your image from Docker Hub and push it to your local registry. For this case we have an ECR registry created on our AWS cloud Platform.
$ docker pull ubuntu:18.04 $ docker images
Here is my command output.
Login to your ECR registry.
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 429758582529.dkr.ecr.eu-central-1.amazonaws.com
Where 429758582529.dkr.ecr.eu-central-1.amazonaws.com is the ECR repository URL.
Then tag and push your image to the registry:
docker tag ubuntu:18.04 429758582529.dkr.ecr.eu-central-1.amazonaws.com/ubuntu18:latest docker push 429758582529.dkr.ecr.eu-central-1.amazonaws.com/ubuntu18:latest
My output screenshot.
Edit Your DockerFile to Pull the Base Image from your Local Registry
On the Docker file replace your base image with the ECR registry URI. See below sample Docker File.
FROM 429758582529.dkr.ecr.eu-central-1.amazonaws.com/ubuntu18 # Install nginx RUN apt-get update && \ apt-get install -y nginx # Install php and supervisor RUN apt-get update && \ apt-get -y upgrade && \ apt-get -y autoremove && \ apt-get install -y php-fpm php-curl supervisor && \ apt-get clean
You have now resolved the issue, and your pipeline will resume working as usual.