简体   繁体   中英

How to change the port number for Docker image of Kibana

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

在此处输入图片说明

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

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.

您无法控制映像的内部端口,但可以将内部端口“ 5601”映射到您想要“ 9201”的端口,如上面的@Vamsi回答

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM