3

How to update heap size in tomcat linux container using dockerfile

trincot
  • 263,463
  • 30
  • 215
  • 251
  • Possible duplicate of [How to set Java heap size (Xms/Xmx) inside Docker container?](https://stackoverflow.com/questions/29923531/how-to-set-java-heap-size-xms-xmx-inside-docker-container) – Konrad Borowski Feb 02 '18 at 07:11

2 Answers2

0

The docker image for tomcat using the catalania.sh script to start tomcat. The jvm memory options are read from environment variables. In particular, you can JAVA_OPTS env variable to set the memory options for the JVM.

JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m"

Thus when starting the container, you can simply start it as such

docker run -e JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m" ...
yamenk
  • 40,626
  • 10
  • 80
  • 81
0

You should be able to set the JAVA_TOOL_OPTIONS as shown below.

ENV JAVA_TOOL_OPTIONS "-XX:MaxRAMPercentage=80"
Archmede
  • 1,302
  • 1
  • 16
  • 32