简体   繁体   中英

docker-compose unknown host?

I can not use the AWS SDK putObject to upload a file to a fake s3 in local stack. I get an unknown host exception when I try to call putObject. The SDK is calling out to my-bucket.localstack:4572 but my docker contain does not seem to be able to resolve the request and throws a unknown host exception. Is there away to point my-bucket.localstack:4572 to localstack?

version: "3"
services:
  app:
    image: app:latest
    command: run
    networks:
      - mynetwork
    ports:
      - 8000:8080
    environment:
      - AWS_ACCESS_KEY_ID=111
      - AWS_SECRET_ACCESS_KEY=111
      - AWS_REGION=us-east-1
      - spring_profiles_active=local

  localstack:
    image: localstack/localstack
    networks:
      - mynetwork
    ports:
      - "4567-4584:4567-4584"
      - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
    environment:
      - SERVICES=sqs,s3

networks:
  mynetwork:
    driver: bridge

Configuring the AWS SDK to use path style access resolved my problem.

See this Github issue: https://github.com/localstack/localstack/issues/43#issuecomment-308273958

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM