awscli 的 Dockerfile

我正在尝试创建一个将安装 awscli 并运行命令以列出 s3 的 docker 文件。一旦命令被执行,容器本身就会退出。我用这个命令 docker build --tag aws-cli:1.0 . 构建图像我在用这个命令 docker run -it --rm -e AWS_DEFAULT_REGION='[your region]' -e AWS_ACCESS_KEY_ID='[your access ID]' -e AWS_SECRET_ACCESS_KEY='[your access key]' aws-cli 构建它之后运行这个 docker 文件错误: Unable to find image 'aws-cli:latest' locally docker: Error response from daemon: pull access denied for aws-cli, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

FROM python:2.7-alpine3.10
ENV AWS_DEFAULT_REGION='[your region]'
ENV AWS_ACCESS_KEY_ID='[your access key id]'
ENV AWS_SECRET_ACCESS_KEY='[your secret]'
RUN pip install awscli
CMD s3 ls
ENTRYPOINT [ "awscli" ]
stack overflow Dockerfile for awscli
原文答案