Open Distro 的 docker-compose 容器不会在异常时自动重启

问题描述

我正在使用 docker-compose 运行 Open Distro,并使用以下 docker-compose.yml 文件:

version: '3'
services:
  opendistro-node:
    image: amazon/opendistro-for-elasticsearch
    network_mode: "host"
    container_name: opendistro
    restart: on-failure
    environment:
      - "DISABLE_INSTALL_DEMO_CONFIG=true"
      - cluster.name=test-cluster
      - node.name=node-1.test-cluster.opendistro.internal
      - discovery.seed_hosts=node-0.test-cluster.opendistro.internal,node-1.test-cluster.opendistro.internal,node-2.test-cluster.opendistro.internal
      - cluster.initial_master_nodes=node-0.test-cluster.opendistro.internal,node-2.test-cluster.opendistro.internal
      - bootstrap.memory_lock=true # along with the memlock settings below,disables swapping
      - "ES_JAVA_OPTS=-Xms2048m -Xmx2048m" # minimum and maximum Java heap size,recommend setting both to 75% of system RAM
      - network.host=node-1.test-cluster.opendistro.internal
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536 # maximum number of open files for the Elasticsearch user,set to at least 65536 on modern systems
        hard: 65536

即使指定了restart: on-failurerestart: always,容器在遇到以下异常时也不会自动重启:

org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to resolve host [dm-1.beinformed-test-v3.opendistro.internal]]; nested: UnknownHostException[node-1.test-cluster.opendistro.internal: Name or service not known];

即使直接使用“docker run”运行单个容器,我也检查了这一点,但看到了与上述相同的行为。还需要配置什么才能使“失败时自动重启”工作?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)