如何在Docker容器内设置Java堆大小(Xms / Xmx)? [英] How to set Java heap size (Xms/Xmx) inside Docker container?

查看:5702
本文介绍了如何在Docker容器内设置Java堆大小(Xms / Xmx)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在提出这个问题时,Docker看起来足够新,无法在网络上回答这个问题。我发现唯一的地方是这篇文章作者说这很难,就是这样。

解决方案

我同意这取决于你使用的是什么容器。如果您正在使用官方 Tomcat图片,它看起来很简单,你将需要使用堆设置传递 JAVA_OPTS 环境变量:

 码头运行--rm -e JAVA_OPTS =' -  Xmx1g'tomcat 

请参阅如何设置JVM参数?


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 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?

这篇关于如何在Docker容器内设置Java堆大小(Xms / Xmx)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆