Cannot connect Kibana to Elasticsearch with different port in docker

I could not connect Kibana to Elasticsearch that is running in a different port in docker. Here is my docker file:

version: '3.2'
services:
  elasticsearch_new_1:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    container_name: elasticsearch_new_1
    environment:
      - node.name=kw-new
      - cluster.name=kw-new
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - elasticsearch_new_1:/usr/share/elasticsearch/data
    ports:
      - 9299:9200
      - 9399:9300
    networks:
      - elastic
  kibana_2:
    image: docker.elastic.co/kibana/kibana:7.6.2
    container_name: kibana_2
    environment:
      - SERVER_NAME=KW_Kibana
      - ELASTICSEARCH_HOSTS=http://elasticsearch_new_1:9299
    ports:
      - 5601:5601
    links:
      - elasticsearch_new_1
    networks:
      - elastic
    depends_on:
      - elasticsearch_new_1

volumes:
  es:
    driver: local
  db:
    driver: local
  elasticsearch_new_1:
    driver: local

networks:
  elastic:
    driver: bridge

It works well when elasticsearch runs in port 9200. I have tried creating kibana.yml but it does not change anything. In the elasticsearch, the following error message:

["java.lang.IllegalStateException: Received message from unsupported version: [1.0.0] minimal compatible version is: [6.8.0]",
        elasticsearch_new_1    | "at org.elasticsearch.transport.InboundMessage.ensureVersionCompatibility(InboundMessage.java:152) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.InboundMessage.access$000(InboundMessage.java:37) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.InboundMessage$Reader.deserialize(InboundMessage.java:70) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.InboundHandler.messageReceived(InboundHandler.java:114) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.InboundHandler.inboundMessage(InboundHandler.java:103) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.TcpTransport.inboundMessage(TcpTransport.java:667) [elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:62) [transport-netty4-client-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:326) [netty-codec-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:300) [netty-codec-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241) [netty-handler-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:600) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:554) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050) [netty-common-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at java.lang.Thread.run(Thread.java:830) [?:?]"] }

According to this message: when Elasticsearch runs in 9200 port, Kibana is using client 1.0.0

["java.lang.IllegalStateException: Received message from unsupported version: [1.0.0] minimal compatible version is: [6.8.0]",

Does anyone know about it?

Thanks

I got it working by changing port of Elasticsearch via environments, I mean I have changed a port number of elasticsearch container. Here are the most important changes:

  1. http.port=9201-9301 in environment
  2. 9201:9201 and 9301:9301 in ports.

Full docker-compose.yml:

version: '3.2'
services:
  elasticsearch_new_1:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    container_name: elasticsearch_new_1
    environment:
      - node.name=kw-new
      - cluster.name=kw-new
      - discovery.type=single-node
      - http.port=9201-9301
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - elasticsearch_new_1:/usr/share/elasticsearch/data
    ports:
      - 9201:9201
      - 9301:9301
    networks:
      - elastic

  kibana_2:
    image: docker.elastic.co/kibana/kibana:7.6.2
    container_name: kibana_2
    environment:
      - SERVER_NAME=KW_Kibana
      - ELASTICSEARCH_HOSTS=http://elasticsearch_new_1:9201
    ports:
      - 5601:5601
    links:
      - elasticsearch_new_1
    networks:
      - elastic
    depends_on:
      - elasticsearch_new_1

volumes:
  es:
    driver: local
  db:
    driver: local
  elasticsearch_new_1:
    driver: local

networks:
  elastic:
    driver: bridge

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