Tung Nguyen Tung Nguyen - 5 months ago 88
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.


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