title: Docker-compose: How to access Localstack resources both from container and host, using same network address
body: <p>I'm using docker-compose to run a python API and a Localstack instance in 2 separate containers, for local development.</p>
  <p>The API has an endpoint which generates a presigned AWS S3 URL and redirects the user, in order to load images directly from S3.</p>
  <p>In local development, the API instantiates a boto3 client using the address of the localstack container as a custom endpoint url (ie: <code>boto3.client(&quot;s3&quot;,endpoint_url=&quot;http://localstack:4566&quot;)</code>) which allows the API to access resources within the localstack container.</p>
  <p>The problem is that the presigned URL returned by the boto3 client uses the <code>localstack</code> address, and the browser cannot load it, since the localstack resources are exposed to the host machine, at <code>http://localhost:4566</code>.</p>
  <p>If I try to set the aws resources endpoint url to <code>localhost</code> in the boto3 client instantiation, then the API, which is running inside of a container, will look for AWS resources within it OWN CONTAINER's localhost, and not the host machine, where the localstack resources are exposed.</p>
  <p>Is there any way to access localstack resources, running in a docker container, from both the host machine's browser AND a different container, using the same address?</p>
  <p>[Edit] I'm using docker on mac, in case that changes anything [/Edit]</p>