Transport_address resolved as IP:PORT in docker

Hello everyone,

I am struggling with Docker and Elasticsearch. I am trying to setup my instance so it has published adddress in format HOSTNAME:PORT and not IP:PORT for both HTTP and transport. I am posting my docker-compose setting (with ES 8.0.0)

  elastic-1:
    container_name: elastic-1
    restart: unless-stopped
    environment:
      - INSTANCE_NAME=elastic-1
      - node.name=elastic-1
      - cluster.name=elastic
      - cluster.initial_master_nodes=elastic-1
      - bootstrap.memory_lock=true
      - ES_SETTING_NETWORK_HOST=elastic-1
      - ES_SETTING_TRANSPORT_HOST=elastic-1
      - ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.transport.cname_in_publish_address=true

Instance is running well however when I call _nodes/_all/os I get following results:

  "nodes": {
    "xjHfLp5gTo2jSEebxUhOAA": {
      "name": "elastic-1",
      "transport_address": "172.20.100.10:9300",
      "host": "elastic-1",
      "ip": "172.20.100.10",
      "version": "8.0.0",
      "http": {
        "bound_address": [
          "172.20.100.10:9200"
        ],
        "publish_address": "elastic-1/172.20.100.10:9200",
        "max_content_length_in_bytes": 104857600
      }

My question is how can I achieve "elastic-1:9300" in transport_address and publish_address? My issue is that I am trying to use Apache Spark connecting to ES and it fails since it tries to connect to node using IP address and not hostname.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.