8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ECR のパブリックイメージのビルドに403エラーが出る解決策

Last updated at Posted at 2021-06-04

エラー

以下の Dockerfile をもとにビルドする

FROM public.ecr.aws/lambda/python:3.8

COPY . ${LAMBDA_TASK_ROOT}
RUN pip install -r requirements.txt
CMD ["app.handler"]

すると以下のようにエラーが出た
アクセス権がない様子

$ docker build -t lambda-func .
[+] Building 1.1s (3/3) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                    0.0s 
 => => transferring dockerfile: 31B                                                                                                                                                                                     0.0s 
 => [internal] load .dockerignore                                                                                                                                                                                       0.0s 
 => => transferring context: 2B                                                                                                                                                                                         0.0s 
 => ERROR [internal] load metadata for public.ecr.aws/lambda/python:3.8                                                                                                                                                 0.9s 
------
 > [internal] load metadata for public.ecr.aws/lambda/python:3.8:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests 3.8]: 403 Forbidden

解決策

以下を叩いて認証を得る

aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
8
5
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
8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?