Elastic Search, Docker and max virtual memory areas error

Hello,
My YAML file is as follows:

services:
  es01:
    image: elasticsearch:8.13.0
    container_name: Elasticsearch01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    deploy:
        resources:
            limits:
                cpus: "2"
                memory: 4G
            reservations:
                memory: 2G
    logging:
      options:
        max-size: "5m"
#    volumes:

    ports:
      - 127.0.0.1:9200:9200
      - 127.0.0.1:9300:9300

  es02:
    image: elasticsearch:8.13.0
    container_name: Elasticsearch02
    environment:
      - node.name=es02
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    deploy:
        resources:
            limits:
                cpus: "2"
                memory: 4G
            reservations:
                memory: 2G
    logging:
      options:
          max-size: "5m"
#    volumes:


  es03:
    image: elasticsearch:8.13.0
    container_name: Elasticsearch03
    environment:
      - node.name=es03
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es02
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    deploy:
        resources:
            limits:
                cpus: "2"
                memory: 4G
            reservations:
                memory: 2G
    logging:
    options:
        max-size: "5m"
#    volumes:

I got the following error:

Elasticsearch01  | {"@timestamp":"2024-04-22T10:58:06.681Z", "log.level":"ERROR", "message":"node validation exception\n[2] bootstrap checks failed. You must address the points described in the following [2] lines before starting Elasticsearch. For more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.13/bootstrap-checks.html]\nbootstrap check failure [1] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]; for more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.13/_maximum_map_count_check.html]\nbootstrap check failure [2] of [2]: Transport SSL must be enabled if security is enabled. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]; for more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.13/bootstrap-checks-xpack.html#bootstrap-checks-tls]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.Elasticsearch","elasticsearch.node.name":"es01","elasticsearch.cluster.name":"es-docker-cluster"}
Elasticsearch01  | ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/es-docker-cluster.log
Elasticsearch01  | ERROR: Elasticsearch died while starting up, with exit code 78
Elasticsearch01  | {"@timestamp":"2024-04-22T11:11:01.623Z", "log.level":"ERROR", "message":"node validation exception\n[1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. For more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.13/bootstrap-checks.html]\nbootstrap check failure [1] of [1]: Transport SSL must be enabled if security is enabled. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]; for more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.13/bootstrap-checks-xpack.html#bootstrap-checks-tls]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.bootstrap.Elasticsearch","elasticsearch.node.name":"es01","elasticsearch.cluster.name":"es-docker-cluster"}
Elasticsearch01  | ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/es-docker-cluster.log
Elasticsearch01  | ERROR: Elasticsearch died while starting up, with exit code 78

I ran the command sysctl -w vm.max_map_count=262144, but problem exist.

Any idea?

Thank you.

@hack3rcon exactly which OS?
Did you stop and start the docker process?

Not to mention that compose will not work because of the incorrect security settings

Also please use 8.13.2 ...

Perhaps you should use the recommended compose here