Docker和设置JVM参数 [英] Docker and setting JVM parameters

查看:1761
本文介绍了Docker和设置JVM参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用此类JVM选项在Docker容器中运行Java应用程序,但是我不知道在哪里可以设置它,我尝试使用"java -Dcom ...."命令,但没有工作.做这个的最好方式是什么?

I need to run Java application in the Docker container with JVM options like these, but I have no idea where I can set it, I've tried use "java -Dcom...." command but it doesn't work. What is the best way to do this?

-Dcom.sun.management.jmxremote.rmi.port = 9090

-Dcom.sun.management.jmxremote.rmi.port=9090

-Dcom.sun.management.jmxremote = true

-Dcom.sun.management.jmxremote=true

-Dcom.sun.management.jmxremote.port = 9090

-Dcom.sun.management.jmxremote.port=9090

-Dcom.sun.management.jmxremote.ssl = false

-Dcom.sun.management.jmxremote.ssl=false

-Dcom.sun.management.jmxremote.authenticate = false

-Dcom.sun.management.jmxremote.authenticate=false

-Dcom.sun.management.jmxremote.local.only = false

-Dcom.sun.management.jmxremote.local.only=false

-Djava.rmi.server.hostname = 192.168.99.100

-Djava.rmi.server.hostname=192.168.99.100

推荐答案

以下是我为您提供的示例:

Here my example for you:

CMD java -Xmx1024m -Xms512m -Dserver.port=8080 -jar mywar.war

此外,如果您要在此处添加许多属性,则最好使用环境变量创建文件.并将它们加载到容器中.并在您的应用程序中使用env变量来泛化您的应用程序.

Also if you have a lot of properties to add here it will be the best to create the file with environment variables. And load them to the container. And in your application use env variables to generify your app.

这篇关于Docker和设置JVM参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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