エラー内容

なんもしてないのに突然はじかれるようになった

1
2
3
4
5
6
7
8
9
10
11
$ docker compose build
[+] Building 5.1s (3/3) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for public.ecr.aws/lambda/python:3.9 5.0s
------
> [internal] load metadata for public.ecr.aws/lambda/python:3.9:
------
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests 3.9]: 403 Forbidden

対処

1回ログアウトするといいらしい

1
$ docker logout public.ecr.aws

そのあと再ログイン(ビルドするだけなら必要ないかも)

1
$ aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws