localstack trying to connect to localhost:4566 when we explicitly have the url set to 4576

Viewed 6998

My team is trying to get a local setup for our project. We are running the same docker-compose file with image localstack/localstack:0.8.10. We are running the same shell script. Our script looks like this...

awslocal sns subscribe \
    --topic-arn arn:aws:sns:us-east-1:123456789012:cx-clientcomm-traffic-controller-sent \
    --protocol sqs \
    --notification-endpoint http://localhost:4576/queue/cx-clientcomm-request-processor-queue

For whatever reason, two of the developers are getting this error. Could not connect to the endpoint URL: http://localhost:4566 for the SQS.

I know this port is used for the latest versions of localstack, but they're running the same image as us.

Any ideas??

1 Answers

It is known issue. You need to add in docker-compose lockalstack image next properties

HOSTNAME_EXTERNAL

hostname: localstack

so original docker-compose will looks like:

localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack}"
image: localstack/localstack
hostname: localstack
networks:
  - anynet
ports:
  - "4566:4566"
environment:
  - SERVICES=sqs,sns
  - DEBUG=1
  - DOCKER_HOST=unix:///var/run/docker.sock
  - HOST_TMP_FOLDER=${TMPDIR}
  - HOSTNAME_EXTERNAL=localstack
volumes:
  - ./data:/tmp/localstack
  - "/var/run/docker.sock:/var/run/docker.sock"

And it will not work if you put localhost to both of properties!!! You need to choose another name. I put localstack for hostname and HOSTNAME_EXTERNAL and it works for me

Related