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 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 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?


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: