Hey all!

I'm using localstack for a project where I consume data from kinesis, process it and put it in elasticsearch.

In the later versions of localstack 'elasticsearch' was removed and is now lazily loaded after call to es::CreateElasticsearchDomain (at least that's how I understand it from #1881, #1865, #1870).

I'm running localstack in a docker using testcontainers (which gives me dynamic port mappings etc). My processing code is running on localhost.

The problem I'm facing now is that the response from es::CreateElasticsearchDomain returns an elasticsearch endpoint like: http://[docker container id]:port.
With my set up, this gives me two issues:
1. [docker container id] host is not (I believe) reachable from localhost unless I add it to /etc/hosts or something like that. I can surely "hack" my way around this by just replacing [docker container id] with localhost.
2. It says here: https://github.com/localstack/localstack/issues/1881#issuecomment-567495056 that we should not assume that elasticsearch will run on a static port in the future. When running localstack in a docker, how would I know which port to expose then in order to reach elasticsearch from localhost?

I currently have my tests running using 1.10.7 but there I just make a dummy call to es::CreateElasticsearchDomain and hardcode elasticsearch endpoint to http://localhost:4571. (It seems like it always chooses 4571 as of now?)

Thanks
Stefan
data = json.loads(to_str(request.data))
    result = []
    domain_names = data.get('DomainNames', [])
    for domain_name in ES_DOMAINS:
        if domain_name in domain_names:
            status = get_domain_status(domain_name)
            status = status.get('DomainStatus') or status
            result.append(status)
    result = {'DomainStatusList': result}
    return jsonify(result)
@app.route('%s/es/domain/<domain_name>/config' % API_PREFIX, methods=['GET', 'POST'])
def domain_config(domain_name):
    config = get_domain_config(domain_name)
    return jsonify(config)
@app.route('%s/es/domain/<domain_name>' % API_PREFIX, methods=['DELETE'])
def delete_domain(domain_name):
    if domain_name not in ES_DOMAINS:
        return error_response(error_type='ResourceNotFoundException')
    result = get_domain_status(domain_name, deleted=True)
    status = ES_DOMAINS.pop(domain_name)
    if not ES_DOMAINS:
        cleanup_elasticsearch_instance(status)
    
    event_publisher.fire_event(event_publisher.EVENT_ES_DELETE_DOMAIN,
        payload={'n': event_publisher.get_hash(domain_name)})
    persistence.record('es', request=request)
    return jsonify(result)
@app.route('%s/es/compatibleVersions' % API_PREFIX, methods=['GET'])
def get_compatible_versions():