Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/CD Pipeline CodeBuild Fail - Docker toomanyrequests: You have reached your pull rate limit. #237

Open
kelleybryant opened this issue Dec 4, 2020 · 7 comments

Comments

@kelleybryant
Copy link

Hello - I am trying to do the automated build in Code Pipeline and I'm getting a Docker rate limit error. Any ideas on how to fix this? Thanks

[Container] 2020/12/04 21:51:03 Waiting for agent ping

2 | [Container] 2020/12/04 21:51:05 Waiting for DOWNLOAD_SOURCE
3 | [Container] 2020/12/04 21:51:07 Phase is DOWNLOAD_SOURCE
4 | [Container] 2020/12/04 21:51:07 CODEBUILD_SRC_DIR=/codebuild/output/src224797896/src
5 | [Container] 2020/12/04 21:51:07 YAML location is /codebuild/output/src224797896/src/buildspec.yml
6 | [Container] 2020/12/04 21:51:07 Processing environment variables
7 | [Container] 2020/12/04 21:51:07 Moving to directory /codebuild/output/src224797896/src
8 | [Container] 2020/12/04 21:51:07 Registering with agent
9 | [Container] 2020/12/04 21:51:07 Phases found in YAML: 3
10 | [Container] 2020/12/04 21:51:07 PRE_BUILD: 2 commands
11 | [Container] 2020/12/04 21:51:07 BUILD: 4 commands
12 | [Container] 2020/12/04 21:51:07 POST_BUILD: 5 commands
13 | [Container] 2020/12/04 21:51:07 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
14 | [Container] 2020/12/04 21:51:07 Phase context status code: Message:
15 | [Container] 2020/12/04 21:51:07 Entering phase INSTALL
16 | [Container] 2020/12/04 21:51:07 Phase complete: INSTALL State: SUCCEEDED
17 | [Container] 2020/12/04 21:51:07 Phase context status code: Message:
18 | [Container] 2020/12/04 21:51:07 Entering phase PRE_BUILD
19 | [Container] 2020/12/04 21:51:07 Running command echo Logging in to Amazon ECR...
20 | Logging in to Amazon ECR...
21 |  
22 | [Container] 2020/12/04 21:51:07 Running command $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION)
23 | WARNING! Using --password via the CLI is insecure. Use --password-stdin.
24 | Login Succeeded
25 |  
26 | [Container] 2020/12/04 21:51:08 Phase complete: PRE_BUILD State: SUCCEEDED
27 | [Container] 2020/12/04 21:51:08 Phase context status code: Message:
28 | [Container] 2020/12/04 21:51:08 Entering phase BUILD
29 | [Container] 2020/12/04 21:51:08 Running command echo Build started on date
30 | Build started on Fri Dec 4 21:51:08 UTC 2020
31 |  
32 | [Container] 2020/12/04 21:51:08 Running command echo Building the Docker image...
33 | Building the Docker image...
34 |  
35 | [Container] 2020/12/04 21:51:08 Running command docker build -t mythicalmysfits/service:latest .
36 | Sending build context to Docker daemon 14.85kB
37 |  

**38 | Step 1/13 : FROM ubuntu:18.04
39 | toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
40 |  
41 | [Container] 2020/12/04 21:51:08 Command did not exit successfully docker build -t mythicalmysfits/service:latest . exit status 1
42 | [Container] 2020/12/04 21:51:08 Phase complete: BUILD State: FAILED
43 | [Container] 2020/12/04 21:51:08 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker build -t mythicalmysfits/service:latest .. Reason: exit status 1**

44 | [Container] 2020/12/04 21:51:08 Entering phase POST_BUILD
45 | [Container] 2020/12/04 21:51:08 Running command echo Build completed on date
46 | Build completed on Fri Dec 4 21:51:08 UTC 2020
47 |  
48 | [Container] 2020/12/04 21:51:08 Running command echo Pushing the Docker image..
49 | Pushing the Docker image..
50 |  
51 | [Container] 2020/12/04 21:51:08 Running command docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/mythicalmysfits/service:latest
52 | The push refers to a repository [BLACH.dkr.ecr.us-east-2.amazonaws.com/mythicalmysfits/service]
53 | An image does not exist locally with the tag: BLAH.dkr.ecr.us-east-2.amazonaws.com/mythicalmysfits/service
54 |  
55 | [Container] 2020/12/04 21:51:09 Command did not exit successfully docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/mythicalmysfits/service:latest exit status 1
56 | [Container] 2020/12/04 21:51:09 Phase complete: POST_BUILD State: FAILED
57 | [Container] 2020/12/04 21:51:09 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/mythicalmysfits/service:latest. Reason: exit status 1

@michelangelo17
Copy link

michelangelo17 commented Dec 6, 2020

It's a known issue, they are working on creating their own public registry to get around the limits altogether, but here is the article with details on current workarounds:

https://aws.amazon.com/blogs/containers/advice-for-customers-dealing-with-docker-hub-rate-limits-and-a-coming-soon-announcement/

I will try it a bit and report back, but I believe simply authenticating will get you past this issue without a need for a paid account. Currently I believe the pull is being made anonymously, meaning you share the pull limit with all anonymous users. If you log in you should have a pull limit of 100 pulls per 6 hours to yourself, plenty for small projects like this.

There's steps on how to authenticate linked in that article. I'll try to find the time to try it out and update this with any gotchas.

@michelangelo17
Copy link

https://medium.com/rockedscience/fixing-docker-hub-rate-limiting-errors-in-ci-cd-pipelines-ea3c80017acb

Found an even easier article to follow so I tried it out real quick and it worked perfectly. :-)

Should be good to go if you follow those steps.

@kelleybryant
Copy link
Author

kelleybryant commented Dec 6, 2020 via email

@kelleybryant
Copy link
Author

@michelangelo17 Worked! Thanks

@haji-linux
Copy link

In my case, I am using "amazoncorretto:11" as a base image for my multiple Code Build project. I am looking for a way around something like this:

  1. docker pull amazoncorretto:11
  2. docker tag image-id my-username/ecr-repository-name:latest
  3. docker push my-username/ecr-repository-name
    And finally, use that image in Dockerfile as base images instead of a pubic image.
    FROM my-username/ecr-repository-name:latest
    @michelangelo17 will this work and resolve the docker pull limits issue?

@michelangelo17
Copy link

The docker limit is from docker hub, so if you're using ECR instead no reason you should get that error

@michelangelo17
Copy link

If it doesn't work let me know, it makes sense to me, but I'd like to explore it if for some reason it doesn't. (I've only vacationed in Docker Land, I'm not a resident so I'm still learning as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants