エラー
以下の 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