Issue with too little memory, running several docker container (including Elasticsearch)

Hello everyone,

I have an issue with the environment variable discovery.type=single-node when spinning up an Elasticsearch container via docker-compose:

Sample docker-compose file as follows:

    elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
      restart: always
      environment:
        - discovery.type=single-node
        - bootstrap.memory_lock=true
        - network.host=0.0.0.0
        - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
      ulimits:
        memlock:
          soft: -1
          hard: -1

The expected result would be a running single-node docker container. What actually happens is that I get "ERROR: [1] bootstrap checks failed [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured" as error message and the Docker container restarts unsuccessfully. When I add the discovery.type=single-node in the elasticsearch.yml and run the container manually, everything works fine.

EDIT: The error message has nothing to do with the problem. It was caused by manually debugging the issue.

Do you have any suggestions, how can debug this problem further?

Best
lochr

Why not set at least one of these settings as the message suggests?

I did that (although I according to the documentation 127.0.0.1 should be the default):

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
    restart: always
    environment:
      - discovery.type=single-node
      - discovery.seed_hosts=127.0.0.1
      - bootstrap.memory_lock=true
      - network.host=0.0.0.0
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
    ulimits:
      memlock:
        soft: -1
        hard: -1

The container does not boot anyway.

Problem solved. It was a side-effect of too many docker container with too little available memory. This was not an issue when running the isolated Elasticsearch container.

The other error message came when running the isolated Elasticsearch docker container manually, without the discovery.type parameter set.

For the sake of future readers, I don't think the error message quoted above has anything to do with that.

It is, roughly, but the default behaviour is subtly different from the behaviour when you set it explicitly.