'Awscli cannot connect to dynamodb-local in Bitbucket pipeline

I am using the Bitbucket pipleines to setup a docker container with dynamodb-local as the image. When I try to configure the dynamodb-local container (creating tables/listing tables/etc) via the AWS CLI, I get a read timeout error.

Here is a reproducable BB pipleine

image: atlassian/pipelines-awscli:latest

definitions:
  scripts:
    - script: &Config
                docker run --name "check" -p8000:8000 -d --rm -v "${BITBUCKET_CLONE_DIR}/docker/dynamodb:/home/dynamodblocal/data" -w "/home/dynamodblocal" amazon/dynamodb-local:latest -jar DynamoDBLocal.jar -sharedDb -dbPath "./data";
                docker ps;
                AWS_ACCESS_KEY_ID=ABCD AWS_SECRET_ACCESS_KEY=EF1234 aws --region us-west-1 dynamodb describe-table --table-name Resources --endpoint-url http://localhost:8000;
                
pipelines:
  branches:
    "**":
      - step:
          name: Test
          script:
            - *Config
          services:
            - docker
          size: 2x

My indended steps are as follows

  1. Create a Container for the dynamodb-local image
  2. Describe a specific table.

Im expecting the 2nd step to error, as I will be creating a table if the one im looking for does not exist.

However, the process hangs and a read timeout occurs as the aws command is unable to communicate with the container.

Am I missing something obvious here? This pattern works locally on my machine fine and only hangs in the bitbucket pipeline.

BTW atlassian/pipelines-awscli:latest is using awscli version 1



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source