Use G1GC in Docker ELK's Elasticsearch

There are some GC issues causing Elasticsearch in the ELK stack to freeze and hit 100% CPU usage. The ELK is setup using docker-elk. Elasticsearch 6.5 comes with G1GC support according to this official post. Let’s see if it helps. In docker-compose.yml: elasticsearch: build: context: elasticsearch/ args: ELK_VERSION: $ELK_VERSION volumes: - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro ports: - "9200:9200" - "9300:9300" environment: ES_JAVA_OPTS: "-Xmx256m -Xms256m" networks: - elk Change the line: ES_JAVA_OPTS: "-Xmx256m -Xms256m" to