# Setting heap size at docker-compose

**URL:** <https://discuss.elastic.co/t/setting-heap-size-at-docker-compose/156326>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [November 12, 2018, 5:12pm UTC](https://discuss.elastic.co/t/setting-heap-size-at-docker-compose/156326 "2018-11-12T17:12:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rancor](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@rancor](https://discuss.elastic.co/u/rancor)\
**Post date:** [November 12, 2018, 5:12pm UTC](https://discuss.elastic.co/t/setting-heap-size-at-docker-compose/156326/1 "2018-11-12T17:12:20Z")

</div>

At a docker-compose for an ELK stack, I have set up ES like this:

```
elasticsearch:
  image: elasticsearch:latest
  command: elasticsearch
  environment:
    - "ES_JAVA_OPTS=-Xms3g -Xmx3g"
  volumes:
    - ./elasticsearch/storage:/usr/share/elasticsearch/data
  ports:
    - "9200:9200"
    - "9300:9300"

```

But, when running docket top es-container, I'm still seeing heap size as 2g (from jvm.options file inside the container) and after that, the 3g I set:

```
UID PID PPID C STIME TTY TIME CMD
102 17420 17403 21 00:00 ? 03:00:18 /docker-java-home/jre/bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Xms3g -Xmx3g -Des.path.home=/usr/share/elasticsearch -cp /usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch

```

Is it taking 2g or 3g? I don't have ps, top or some tools like that at the es container, I'm using the latest image BTW.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 10, 2018, 5:12pm UTC](https://discuss.elastic.co/t/setting-heap-size-at-docker-compose/156326/2 "2018-12-10T17:12:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
