Tung Nguyen Tung Nguyen -4 years ago 333
Java Question

How to set Java heap size (Xms/Xmx) inside Docker container?

As of raising this question, Docker looks to be new enough to not have answers to this question on the net. The only place I found is this article in which the author is saying it is hard, and that's it.

Answer Source

I agree that it depends on what container you're using, if you are using the official Tomcat image, it looks like it's simple enough, you will nee to pass the JAVA_OPTS environment variable with your heap settings (see: How to set JVM parameters?)

docker run --rm -e JAVA_OPTS='-Xmx1g' tomcat
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download