LoginSignup
2
0

More than 3 years have passed since last update.

CodeBuildでのDockerHubのダウンロードレート制限によるエラー(DockerHub pull rate limit error)を楽に解決する!?(Amazon ECR Public)

Last updated at Posted at 2020-12-14

re:Invent2020でAmazon ECR Publicが発表されました。
Amazon ECR Public および Amazon ECR Public Gallery を発表

自分の周りでもCodeBuildが最近落ちまくっており、DockerHubへログインすれば大丈夫との噂を聞いていたのですが、IPガチャを何回も回すことで回避?していました。そろそろ修正しなきゃなと思っていたところ、上記リリースでこの問題を容易に回避することができそうなので、早速修正していきます。

(参考)最近のCodeBuildとの戦い...

複数回連続で落ちることもザラ

スクリーンショット 2020-12-14 23.23.55.jpg

修正の前提

  • Amazon ECR Public Galleryに公式イメージが存在すること(nginxとかです)

まだpythonとかは用意されていなさそうです(2020/12/14時点)。

Amazon ECR Public Galleryで公式イメージを探す

いた!

スクリーンショット 2020-12-14 23.18.19.png

スクリーンショット 2020-12-14 23.20.35.png

DockerHubとバージョンも同じ
→同一のレポジトリ(GitHubのDockerFile)がリンクされていました。

スクリーンショット 2020-12-14 23.21.06.png

早速修正

Before

Dockerfile
FROM nginx:alpine
/codebuild/log
[Container] 2020/11/25 11:24:30 Running command docker build -t $REPOSITORY_URI:$IMAGE_TAG docker/
Sending build context to Docker daemon  14.69MB

Step 1/8 : FROM nginx:alpine
toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

After

Dockerfile
FROM public.ecr.aws/nginx/nginx:alpine
  • log
/codebuild/log
[Container] 2020/12/14 02:09:54 Running command docker build -t $REPOSITORY_URI:$IMAGE_TAG docker/
Sending build context to Docker daemon   14.7MB

Step 1/8 : FROM public.ecr.aws/nginx/nginx:alpine # <---------- ECR Public経由
alpine: Pulling from nginx/nginx

これで当分buildが安定しそうです。

参考リンク

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0