title: How to fix dynamodb local call using docker-compose
body: <p>I'm starting a springboot app and dynamodb local in docker containers via docker-compose.</p>
  
  <p>Both containers come up successfully.</p>
  
  <p>When I use the container name for the AMAZON_AWS_DYNAMODB_ENDPOINT value, I get the following error:</p>
  
  <pre><code>[https-jsse-nio-8443-exec-6] [2019-04-15 08:03:42,239] INFO   com.amazonaws.protocol.json.JsonContent [] - Unable to parse HTTP response content
  com.fasterxml.jackson.core.JsonParseException: Unexpected character ('&lt;' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
  at [Source: (byte[])"&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
  &lt;html&gt;&lt;head&gt;
  &lt;title&gt;301 Moved Permanently&lt;/title&gt;
  &lt;/head&gt;&lt;body&gt;
  &lt;h1&gt;Moved Permanently&lt;/h1&gt;
  &lt;p&gt;The document has moved &lt;a href="http://aws.amazon.com/dynamodb/"&gt;here&lt;/a&gt;.&lt;/p&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Further down I'm getting the following error:</p>
  
  <pre><code>com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException: null (Service: AmazonDynamoDBv2; Status Code: 301; Error Code: null; Request ID: null)
  </code></pre>
  
  <p>If I replace the AMAZON_AWS_DYNAMODB_ENDPOINT value with my Windows computer IP address (running the containers) it works successfully.</p>
  
  <p>Any suggestions on how to get the container name working?</p>
  
  <p>Here's my docker-compose:</p>
  
  <pre><code>version: '3'
  services:
    dynamodb:
      image: amazon/dynamodb-local
      ports:
        - "8000:8000"
      volumes:
        - dynamodata:/data
      command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ."
  
    app:
      build: .
      ports:
        - "8443:8443"
  
      environment:
        - SERVER_PORT=8443
        - SERVER_SSL_KEY_STORE=/etc/ssl/key
        - SERVER_SSL_KEY_STORE_TYPE=PKCS12
        - SERVER_SSL_KEY_ALIAS=tomcat
        - SERVER_SSL_KEY_STORE_PASSWORD=xxxxxx
        - SPRING_PROFILES_ACTIVE=aws,local
        - DATAPOWER_ENABLED=true
  #      - AMAZON_AWS_DYNAMODB_ENDPOINT=${DYNAMODB_ENDPOINT:-http://dynamodb:8000}  &lt;--- does not work
  #      - AMAZON_AWS_DYNAMODB_ENDPOINT=${DYNAMODB_ENDPOINT:-http://xx.xxx.xxx.xxx:8000}  &lt;--- works
        - AMAZON_AWS_DYNAMODB_REGION=${DYNAMODB_REGION:-us-east-1}
        - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-local}
        - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-xxxxxxxxxx}
        - ENV=dev
        - AWS_REGION=us-east-1
  
  volumes:
    dynamodata:
  </code></pre>
  
  <p>Thanks</p>