Access localstack in docker container from host machine

I have localstack running in a docker container and an application running on the host machine which connects to it via localhost:4566.

In localstack 2.0.2 when my application tried to get an SQS Queue URL, localstack would respond with something like http://localhost:4566/000000000000/MyMessage

However, after upgrading to 3.0.0 it returns something like http://sqs.eu-west-1.localstack:4566/000000000000/MyMessage instead.

Notice that the hostname is now localstack instead of localhost. So when my application tries to interact with that queue it fails, since my application isn’t running in the docker network.

Now, I could add 127.0.0.1 sqs.eu-west-1.localstack to /etc/hosts but that solution is less than ideal for several reasons.

Is there some way to configure localstack to behave more like it used to? Or some other approach to solving this that I’m not seeing?

Hi!

There are multiple configuration options to configure how the URLs returned by SQS will look like. Check out our configuration docs for more information: Configuration | Docs

Your case is not actually the default behavior, so I’d guess you’re currently setting a networking configuration variable when starting localstack, which affects how URLs are returned.

Check out Configuration | Docs and especially Accessing a resource created by LocalStack | Docs for more insight here.

Without any configuration, the returned SQS queue URL should currently look like this for a queue named test:

http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/test

Hi,
http://sqs.us-west-1.localhost.localstack.cloud:4566/000000000000/localstack-queue’ -This url is not connecting in local environment using docker in php
How to sendMessage using this url.
please anyone help me to solve this issue