FG
☁️ Cloud & DevOpsAmazon

Can we have jq installed by default in aws v2 cli docker image?

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

Problem

Is your feature request related to a problem? Please describe. We commonly use jq to manipulate json as input or pick properties from aws command output in shell script. It will be really good if we can include jq in official docker image of v2 like what Azure cli does. Describe the solution you'd like include jq program in aws v2 docker image Describe alternatives you've considered We currently build our own custom image for v1 to have jq installed. Additional context

Unverified for your environment

Select your OS to check compatibility.

2 Fixes

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Include jq in AWS CLI v2 Docker Image

Medium Risk

The official AWS CLI v2 Docker image does not include jq, which is a lightweight and flexible command-line JSON processor. This omission limits users' ability to manipulate JSON output directly within the container, leading to the need for custom images or additional processing steps.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Modify Dockerfile for AWS CLI v2

    Update the Dockerfile used to build the AWS CLI v2 image to include the installation of jq. This can be achieved by adding a command to install jq using the package manager available in the base image.

    bash
    RUN apt-get update && apt-get install -y jq
  2. 2

    Build the Updated Docker Image

    After modifying the Dockerfile, build the Docker image to ensure jq is included. Use the Docker build command to create a new image with the updated configuration.

    bash
    docker build -t aws-cli-v2-with-jq .
  3. 3

    Test the New Docker Image

    Run a container from the newly built image and test if jq is available. Execute a simple jq command to verify its functionality.

    bash
    docker run --rm aws-cli-v2-with-jq jq --version
  4. 4

    Push the Updated Image to Repository

    Once verified, push the updated Docker image to a container registry (e.g., Docker Hub or AWS ECR) for easy access and deployment.

    bash
    docker push your-repo/aws-cli-v2-with-jq
  5. 5

    Document the Changes

    Update any relevant documentation to inform users of the new image and how to use jq with the AWS CLI v2 Docker container.

    bash
    echo 'AWS CLI v2 with jq is now available at your-repo/aws-cli-v2-with-jq'

Validation

To confirm the fix worked, run the new Docker image and execute 'jq --version' to check if jq is installed. Additionally, test a sample AWS CLI command piped to jq to ensure it processes JSON output correctly.

Sign in to verify this fix

1 low-confidence fix
Unverified Fix
New Fix – Awaiting Verification

Include jq in AWS CLI v2 Docker Image

Medium Risk

The AWS CLI v2 Docker image does not include jq by default, limiting users' ability to manipulate JSON output directly within the container. This is a common requirement for users who need to process AWS command outputs efficiently in shell scripts.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Modify Dockerfile for AWS CLI v2

    Edit the Dockerfile used to build the AWS CLI v2 image to include the installation of jq. This will ensure that jq is available in the image by default.

    bash
    RUN apt-get update && apt-get install -y jq
  2. 2

    Rebuild the Docker Image

    After modifying the Dockerfile, rebuild the Docker image to apply the changes. This will create a new version of the AWS CLI v2 image that includes jq.

    bash
    docker build -t aws-cli-v2-custom .
  3. 3

    Test the New Image

    Run a container using the newly built image and test if jq is installed correctly by executing 'jq --version'. This will confirm that jq is available for use.

    bash
    docker run --rm aws-cli-v2-custom jq --version
  4. 4

    Push the Custom Image to Repository

    If the tests are successful, push the custom Docker image to a container registry (e.g., Docker Hub or AWS ECR) for easier access and deployment.

    bash
    docker push your-repo/aws-cli-v2-custom
  5. 5

    Update Documentation

    Update any relevant documentation to inform users about the availability of jq in the new AWS CLI v2 Docker image and how to use it.

    N/A
    N/A

Validation

To confirm the fix worked, run a container from the new AWS CLI v2 image and execute a command that uses jq to process JSON output, such as 'aws ec2 describe-instances | jq .'. If jq processes the output correctly, the installation is successful.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

awsclicloudfeature-requestdockerp2