How to update heap size in tomcat linux container using dockerfile
Asked
Active
Viewed 5,375 times
3
-
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 Answers
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
- 46,736
- 10
- 93
- 87
0
You should be able to set the JAVA_TOOL_OPTIONS
as shown below.
ENV JAVA_TOOL_OPTIONS "-XX:MaxRAMPercentage=80"

Archmede
- 1,592
- 2
- 20
- 37