如何拉取 AWS Lambda 容器镜像

How to pull AWS Lambda container image

我正在尝试 运行 AWS Lambda 上的 Docker 容器。 具体来说,我正在关注 this official tutorial

我有以下Dockerfile

FROM public.ecr.aws/lambda/nodejs:12

COPY app app.js package.json /var/task/
RUN npm install

CMD [ "app.handler" ]

但是,当我尝试构建它时出现以下错误:

docker build -t hello-world .

Sending build context to Docker daemon  4.608kB
Step 1/4 : FROM public.ecr.aws/lambda/nodejs:12
pull access denied for public.ecr.aws/lambda/nodejs, repository does not exist or may require 'docker login': denied: Your authorization token has expired. Reauthenticate and try again.

当我使用 docker login 命令登录时,我仍然遇到同样的错误。

有谁知道如何解决这个问题?

在这里工作正常。您不需要 Public ECR 的凭据(您 可以 specific cases 使用身份验证)但是如果您只想使用它,请删除现有凭据

docker logout public.ecr.aws

然后再次尝试构建。

也就是说,如果您仍想使用身份验证,则需要重新授权为 described in the doc

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