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

后端 未结 5 452
囚心锁ツ
囚心锁ツ 2020-12-05 06:56

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 say

5条回答
  •  甜味超标
    2020-12-05 07:10

    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 need to pass the JAVA_OPTS environment variable with your heap settings:

    docker run --rm -e JAVA_OPTS='-Xmx1g' tomcat
    

    See How to set JVM parameters?

提交回复
热议问题