PaaS/CI CD

DockerHub Rate Limit 정책 그리고 이슈

armyost 2024. 8. 3. 20:26
728x90

Docker Hub rate limit | Docker Docs

 

Docker Hub rate limit

Learn how download rate limits for image pulls on Docker Hub work

docs.docker.com

 

 

DockerHub에서 Image Pull을 할 경우 다음의 정책을 따른다.

User type Rate limit
Anonymous users 100 pulls per 6 hours per IP address
Authenticated users 200 pulls per 6 hour period
Users with a paid Docker subscription Up to 5000 pulls per day

 

 

만약 당신의 Kubernetes 혹은 CICD Workflow에서 다음과 같은 이슈가 발생했을때는 같은 IP에서 6시간 동안 100회가 넘는 Image Pull을 했기 때문일 것이다.

ERROR: toomanyrequests: Too Many Requests.
You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limits

 

이를 해결하는 방법은 몇 가지가 있다. 

 

1. Docker Login한 뒤에 Image를 Pull하기

- 가급적 일반 계정보다는 Paid Account를 사용하는것이 여유 있는 Limit Count 확보가 가능하다.

 

2. DockerHub 이 아닌 Mirror 사이트를 사용하거나, ghcr과 같은 별도의 Image Registry를 사용한다.

- GCP에서 관리하는 Mirror Registry ( GCR.IO )

https://cloud.google.com/artifact-registry/docs/pull-cached-dockerhub-images

 

캐시된 Docker Hub 이미지 가져오기  |  Artifact Registry 문서  |  Google Cloud

의견 보내기 캐시된 Docker Hub 이미지 가져오기 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. Artifact Registry는 mirror.gcr.io에서 자주 액세스되는 공개 Docker Hub

cloud.google.com

 

※ GCR.IO에서 Mirror 서비스 하는 이미지 목록은 다음과 같다.

https://console.cloud.google.com/gcr/images/google-containers/GLOBAL 

 

Google Cloud console

Google Cloud 콘솔에서 www.gstatic.com의 자바스크립트 소스를 로드할 수 없습니다. 가능한 원인은 다음과 같습니다. 네트워크 관리자가 www.gstatic.com 또는 IP 주소를 차단합니다.과도한 자동 요청으로

console.cloud.google.com

$ gcloud container images list --project google-containers

 

- GHCR 과 같은 별도의 Registry를 구축하여 사용.

https://github.com/features/packages

 

GitHub Packages: Your packages, at home with their code

With GitHub Packages you can safely publish and consume packages within your organization or with the entire world.

github.com

 

Rate Limit을 확인하는 방법은 다음과 같다.

https://docs.docker.com/docker-hub/download-rate-limit/#how-do-i-know-my-pull-requests-are-being-limited

 

Docker Hub rate limit

Learn how download rate limits for image pulls on Docker Hub work

docs.docker.com