aws-cli

amazon/aws-cli Docker Image

亚马逊云服务(AWS)的通用命令行界面,用于与AWS服务交互和管理AWS资源的Docker镜像,仅支持AWS CLI v2。

324 次收藏下载次数: 0状态:社区镜像维护者:amazon仓库类型:镜像最近更新:
下载命令
点击查看

Amazon Web Services Command Line Interface (AWS CLI)

This is a Docker image for the https://aws.amazon.com/cli/. It is a unified command line tool to interact with AWS services and manage your AWS resources.

NOTE: This image is only supported for the AWS CLI v2

Tags

There are two sets of supported tags:

  • latest - This corresponds to the latest released version of the AWS CLI. There are no backwards compatibility guarantees in relying on the latest tag. See notes on backwards compatibility for more information.

  • <major.minor.patch> - This corresponds to each released version of the AWS CLI. For example to use version 2.0.6 of the AWS CLI, use the tag 2.0.6. These tags are immutable as they will only ever be pushed to once upon release of a particular version of the AWS CLI.

Docker CLI usage

The AWS CLI can be executed from the Docker CLI with the docker run command:

bash
$ docker run --rm -it amazon/aws-cli --version

This command will print out the version of the AWS CLI being used in the container. Note that the aws executable was not specified in the docker run command because the https://docs.docker.com/engine/reference/builder/#entrypoint for the image is defined as the aws executable.

For any AWS CLI command, you can run its help command to get help information about the command:

bash
$ docker run --rm -it amazon/aws-cli help

In order to run a command that makes an AWS API call, credentials and configuration may need to be shared from the host system to the container. Assuming credentials and configuration are being set in the ~/.aws/credentials and ~/.aws/config file on the host system, they can be shared by mounting the ~/.aws directory to the /root/.aws directory of the container:

bash
$ docker run --rm -ti -v ~/.aws:/root/.aws amazon/aws-cli s3 ls

For some AWS CLI v2 commands, you'll want to either read files from the host system in the container or write files from the container to the host system. This can be accomplished by mounting to the container's /aws directory:

bash
$ docker run --rm -ti -v ~/.aws:/root/.aws -v $(pwd):/aws amazon/aws-cli s3 cp s3://aws-cli-docker-demo/hello .

The /aws directory is the working directory for the image and is reserved for the user. See notes on interfaces for more information.

In order to shorten the length of docker commands, you can add the following alias:

bash
$ alias aws='docker run --rm -ti -v ~/.aws:/root/.aws -v $(pwd):/aws amazon/aws-cli'

This will allow you to run the AWS CLI v2 from within a Docker container as if it was installed on the host system:

bash
$ aws --version

Notes on interfaces and backwards compatibility of Docker image

  • The only tool supported on the image is the AWS CLI. Only the aws executable should ever be directly executed. For example even though less and groff are explicitly installed on the image, they should not be executed directly outside of an AWS CLI command.

  • The /aws working directory is user controlled. The image will not write to this directory, unless instructed by the user in running a AWS CLI command.

  • There are no backwards compatibility guarantees in relying on the latest tag. For example theoretically, any of the following changes could happen between updates to latest tag:

    • A specific tool (e.g. less or groff) is removed from the image.

    • The base image is updated (e.g. change from Amazon Linux to Alpine Linux)

    • A new major version of the AWS CLI is published (e.g. an AWS CLI v3)

  • In order to guarantee backwards compatibility, users must pin to a specific <major.minor.patch> tag as those tags are immutable; they will only ever be pushed to once upon release of a particular version of the AWS CLI.

General AWS CLI usage

For information on general usage of the AWS CLI, please refer to the:

  • https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html

  • https://docs.aws.amazon.com/cli/latest/reference/

Source code

The source code for the AWS CLI can be found at its https://github.com/aws/aws-cli/tree/v2. The Docker image is built using the https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html for the AWS CLI v2 and the following https://github.com/aws/aws-cli/tree/v2/docker/Dockerfile.

Feedback

To file any feature requests or report any issues related to this Docker image, please open an issue on the https://github.com/aws/aws-cli for the AWS CLI.

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 aws-cli 镜像标签

docker pull docker.xuanyuan.run/amazon/aws-cli:<标签>

DockerHub 原生拉取命令

docker pull amazon/aws-cli:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告