简体   繁体   中英

How to set port number for Elasticsearch running in Docker in host network mode

I need to change the port number of Elasticsearch that is running in Docker in host.network mode.

Port mapping does not apply in host.network mode.

The relevent part of my docker-compose.yml file looks like this:

services:
  elasticsearch_place_data:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    container_name: elasticsearch_place_data
    restart: on-failure
    environment:
    - discovery.type=single-node
    - http.host=0.0.0.0
    - ES_JAVA_OPTS=-Xms512m -Xmx512m
    - xpack.security.enabled=false
    volumes:
    - es_place_data:/usr/share/elasticsearch/data
    networks_mode: host

you will want to use http.port and transport.port as per the documentation

Seems like there are only two options:

  • Create own modified docker image of ELasticsearch with exposed port changed.
  • Use external port-forwarding. eg ssh tunnel. (justified in very rare cases)

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