FG
☁️ Cloud & DevOpsAmazon

Provide Official AWS CLI Docker Image

Freshabout 21 hours ago
Mar 14, 20260 views
Confidence Score95%
95%

Problem

I was surprised to find that there is no official Docker image for development with the AWS CLI. The "amazon" user on Docker Hub contains only the these images for working specifically with ECS and Elastic Beanstalk, and there do not appear to be any official Amazon Docker images on the new Docker Store yet. When I searched "aws cli" on Docker Hub, the most popular image (with 1M+ downloads) was this one, created by Mesosphere. It's good enough, with a very simple Dockerfile based on the super-tiny Alpine Linux image. Upon further investigation, I found the `aws-codebuild-docker-images` repo in this organization, with an `ubuntu-base` Dockerfile. This image looks great, so why hasn't it been pushed to Docker Hub/Store? For that matter, why haven't any of the images in that repo been pushed? The Mesosphere `aws-cli` image will work fine, but its simplicity compared to that `ubuntu-base` made me concerned that it hasn't been properly optimized; similarly, the `ubuntu-base` image is based off Ubuntu 14.04.5, which is both old and bulky compared to Alpine Linux. TL; DR I believe there should be an official `aws-cli` Docker image maintained by Amazon and pushed to Docker Hub/Store. Ideally, it should support all the major modern Linux distros, including Alpine Linux. One should be able to run the following command, and have everything just work: `docker run -it amazon/aws-cli` EDIT This Issue is now being tracked at #3553. You should like that one to show your support

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Create and Publish Official AWS CLI Docker Image

Medium Risk

Currently, there is no official AWS CLI Docker image available on Docker Hub, which leads to reliance on unofficial images that may not be optimized or maintained. The absence of an official image prevents users from easily accessing a reliable and up-to-date AWS CLI environment.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Create Dockerfile for AWS CLI

    Develop a Dockerfile that installs the AWS CLI using a lightweight base image like Alpine Linux. This ensures that the image is optimized for size and performance.

    dockerfile
    FROM alpine:latest
    RUN apk add --no-cache python3 py3-pip && pip3 install awscli
    ENTRYPOINT ["aws"]
  2. 2

    Build the Docker Image

    Use the Docker CLI to build the Docker image from the Dockerfile created in the previous step. Tag the image appropriately for future reference.

    bash
    docker build -t amazon/aws-cli .
  3. 3

    Push the Docker Image to Docker Hub

    Authenticate with Docker Hub and push the newly created AWS CLI image to the official Amazon repository on Docker Hub.

    bash
    docker login
    
    docker push amazon/aws-cli
  4. 4

    Document the Image Usage

    Create a README file that explains how to use the official AWS CLI Docker image, including examples of common commands and configurations.

    bash
    echo '# AWS CLI Docker Image
    
    ## Usage
    
    `docker run -it amazon/aws-cli`' > README.md
  5. 5

    Monitor and Update the Image Regularly

    Establish a process for regularly updating the Docker image to include the latest version of the AWS CLI and any necessary dependencies.

    bash
    docker pull amazon/aws-cli && docker build -t amazon/aws-cli .

Validation

To confirm the fix worked, run the command `docker run -it amazon/aws-cli --version` to check if the AWS CLI is installed and functioning correctly. Additionally, verify that the image is available on Docker Hub by searching for 'amazon/aws-cli'.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

awsclicloudduplicateguidanceservice-api