본문 바로가기
infra

[TIL] aws codebuild에서 docker image pull rate limit 해결하기

by marble25 2023. 12. 15.

오늘 AWS codebuild에서 docker image를 빌드할 때 pull rate limit 에러가 났는데 이를 해결한 과정을 적어두고자 한다.

Context

CI/CD를 위해 code pipeline을 붙여놓고, code pipeline에 code build를 포함시켜서 docker image를 build하는 과정을 포함시켰다.

Base image는 debian:bookworm-slim 이다.

Problem

오늘 많은 코드를 머지시켰고, CD pipeline이 많이 돌았다.

머지 후 code build에서 docker image를 빌드하는 도중 다음과 같은 에러가 발생했다.

#4 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code <https://registry-1.docker.io/v2/library/debian/manifests/sha256:2bc5c236e9b262645a323e9088dfa3bb1ecb16cc75811daf40a23a824d665be9:> 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: <https://www.docker.com/increase-rate-limit>

 

Solution

docker hub도 rate limit이 존재한다.

Anonymous usage를 위해서는 6시간에 100개의 image request가 가능하고, Free docker account에 대해서는 6시간에 200개의 image request가 가능하다. Docker pro나 Docker team 계정은 24시간에 5000 pull이 가능하다.

하지만 우리는 pro나 team 계정을 사용하고 있지 않기 때문에 base image를 ecr에 올리는 방법을 선택했다.

Local 환경에 debian:bookworm-slim 이미지를 pull 한 후, AWS ECR에 debian:bookworm-slim 이미지를 push했다.

그 후 dockerfile에서 Base image를 ECR에 적혀있는 URI에 맞게 변경했다.

그 후 code build에 적용 후 다시 pipeline을 trigger하니 도커 이미지가 문제없이 잘 빌드되었다.

'infra' 카테고리의 다른 글

AWS lambda layer  (0) 2024.03.23
aws code pipeline blue / green 배포  (0) 2024.01.12
[TIL] mig 해제하기  (0) 2023.12.14
[TIL] js pm2 패키지  (0) 2023.11.05
무중단 배포 프로세스  (0) 2023.09.17