4

I am running Kibana using Docker

Below is the docker-compose that I am using for running Kibana Fluentd and Elastic-Search.

version: '2'
services:
  elasticsearch:
    image: elasticsearch
    expose:
      - 9200
    ports:
      - "9200:9200"
    networks:
      - cloud      


  fluentd:
    build: ./fluentd
    volumes:
      - ./fluentd/conf:/fluentd/etc
    links:
      - "elasticsearch"
    ports:
      - "24224:24224"
      - "24224:24224/udp"
    networks:
      - cloud  


  kibana:
    image: kibana
    links:
      - "elasticsearch"
    ports:
      - "9201:5601"
    networks:
      - cloud

networks:
  cloud:
   driver: bridge  

My Problem statement is as below:

I want to run the Kibana on 9201 port. I have mention the same in docker-compose.yml still It get run on its default port 5601

enter image description here

Please Let me know what changes I need to do for running Kibana on 9201

3 Answers 3

5

Use this:

kibana:
image: kibana
links:
  - "elasticsearch"
ports:
  - "9201:5601"
networks:
  - cloud

Edit :

Explanation : Your service kabana is running on the port 5601 of the container. So

ports:
   -"9201:5601"

links the port 5601 of the container to the port 9201 of the host machine.

7
  • 1
    I have change the port in docker-compose as per @Vamsi mention.The reason why I want to change the Port is 5601 is blocked for getting called from Outside VM. still If I call http://host-name:9201 I get Connection Time-Out. My Problem remain the same. Please suggest If I am doing something wrong. Commented Apr 3, 2018 at 6:56
  • 1
    Make sure that your container is up. From which machine are you trying to access the service kabana? Is that different from where the docker containers are running?
    – Vamsi
    Commented Apr 3, 2018 at 7:05
  • 1
    All the containers are running on ubuntu machine where I have docker setup. I am trying to access the container from outside VM like any public internet. I am calling the services using api-gateway using zuul routes. I can see the call are landing to api-gateway. eg http://hostname:9201 it's not forwarding the request to kibana 5601 Commented Apr 3, 2018 at 7:40
  • 1
    Could it be a problem related to kibana image??
    – Binary
    Commented Apr 3, 2018 at 7:44
  • 1
    @Binary I am not sure , I am implementing Kibana first time , I am using the docker image kibana: image: kibana Commented Apr 3, 2018 at 7:52
4

You need to set the port via the SERVER_PORT environment variable. It's very practical when you're running the container in the host network.

2

you have no control over the image's internal port but you can map the internal port "5601" to the port you want "9201" as @Vamsi answer above

2
  • I have done the change still My problem remain the same. Commented Apr 3, 2018 at 6:57
  • it seems that there is some enviroment variables that needs to be set in docker compose file as per the following documentation elastic.co/guide/en/kibana/current/…
    – Binary
    Commented Apr 3, 2018 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.