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=true

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

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

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

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

-Djava.rmi.server.hostname=192.168.99.100

解决方案

Here my example for you:

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

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.

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐