### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

I am using below docker-compose file to start the localstack container with es service
```
version: "3"
services:
  wiremock:
    image: "rodolpheche/wiremock"
    ports:
      - "8080"
  localstack:
    image: "localstack/localstack-full:0.14.2"
    ports:
      - "4566"
      - "4510:4510"
    environment:
      AWS_ACCESS_KEY_ID: "local-access-key-id"
      AWS_SECRET_ACCESS_KEY: "local-secret-access-key"
      HOSTNAME_EXTERNAL: "localstack"
      OPENSEARCH_ENDPOINT_STRATEGY: "port"
      SERVICES: "es"
      EDGE_PORT: "4566"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"

```

running `aws --region ap-south-1 --endpoint-url http://localstack:4566 es create-elasticsearch-domain --domain-name my-domain` to create domain
this command is returning `localhost:4510` as an endpoint, I am able to curl `curl localhost:4510` within localstack bash but 
neither on the host machine nor in `wiremock` container.



### Expected Behavior

I should able to access elastic search domain in host machine as well in another container

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

#### How are you starting localstack

 ```
version: "3"
services:
  wiremock:
    image: "rodolpheche/wiremock"
    ports:
      - "8080"
  localstack:
    image: "localstack/localstack-full:0.14.2"
    ports:
      - "4566"
      - "4510:4510"
    environment:
      AWS_ACCESS_KEY_ID: "local-access-key-id"
      AWS_SECRET_ACCESS_KEY: "local-secret-access-key"
      HOSTNAME_EXTERNAL: "localstack"
      OPENSEARCH_ENDPOINT_STRATEGY: "port"
      SERVICES: "es"
      EDGE_PORT: "4566"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"

```

#### Client commands

    aws --region ap-south-1 --endpoint-url http://localstack:4566 es create-elasticsearch-domain --domain-name my-domain


### Environment

```markdown
- OS:
- LocalStack:
```


### Anything else?

_No response_
"""
    Queries the health endpoint of OpenSearch/Elasticsearch and returns either the status ('green', 'yellow',
    ...) or None if the response returned a non-200 response.
    """
    resp = requests.get(url + "/_cluster/health")
    if resp and resp.ok:
        opensearch_status = resp.json()
        opensearch_status = opensearch_status["status"]
        return opensearch_status
    return None
def init_directories(dirs: Directories):
    """Makes sure the directories exist and have the necessary permissions."""
    LOG.debug("initializing cluster directories %s", dirs)
    chmod_r(dirs.install, 0o777)
    if not config.dirs.data or not dirs.data.startswith(config.dirs.data):
        
        rm_rf(dirs.data)
    rm_rf(dirs.tmp)
    mkdir(dirs.tmp)
    chmod_r(dirs.tmp, 0o777)
    mkdir(dirs.data)
    chmod_r(dirs.data, 0o777)
    mkdir(dirs.backup)
    chmod_r(dirs.backup, 0o777)
    
    for d, dirs, files in os.walk(dirs.data, True):
        for f in files:
            if f.endswith(".lock"):
                rm_rf(os.path.join(d, f))
def resolve_directories(version: str, cluster_path: str, data_root: str = None) -> Directories: