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

Note that in a docker-compose.yml file – you’ll need to leave out the double-quotes:

  environment:
  - JVM_OPTS=-Xmx12g -Xms12g -XX:MaxPermSize=1024m

or

  environment:
  - CATALINA_OPTS=-Xmx12g -Xms12g -XX:MaxPermSize=1024m

Leave a Comment