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

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

问题描述

在提出这个问题时,Docker 看起来足够新,无法在网络上回答这个问题.我找到的唯一地方是这篇文章作者说这很难,仅此而已.

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.

推荐答案

我同意这取决于您使用的容器.如果你使用的是官方的Tomcat镜像,看起来很简单,你会需要使用堆设置传递 JAVA_OPTS 环境变量:

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

参见如何设置JVM参数?

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

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