How to monitor java application memory usage in Docker

前端 未结 6 1200
刺人心
刺人心 2020-12-29 12:04

I run the java web application on tomcat in the Docker container.

Is there any way to monitor the memory usage of the java application? I try to use jconsole<

6条回答
  •  爱一瞬间的悲伤
    2020-12-29 12:44

    To connect to a java process running in a docker container running in boot2docker with visualvm you can try the following:

    Start your java process using the following options:

    java -Dcom.sun.management.jmxremote.port= \
    -Dcom.sun.management.jmxremote.authenticate=false \
    -Dcom.sun.management.jmxremote.ssl=false \
    -Dcom.sun.management.jmxremote.rmi.port= \
    -Djava.rmi.server.hostname= \
    

    You need to run your image with --expose -p :.

    Then "Add JMX Connection" in visualvm with :.

    It shouldn't be much different without boot2docker.

提交回复
热议问题