[英]How to access JMX interface in docker container on VM from outside?
I am trying to remotely monitor a JVM running in docker.我正在尝试远程监控在 docker 中运行的 JVM。 The configuration looks like this:配置如下所示:
machine: runs a JVM (in my case, Hello-World springboot app) in docker on an ubuntu machine (VM);机器:在 ubuntu 机器(VM)上的 docker 中运行 JVM(在我的例子中是 Hello-World springboot 应用程序); the IP of this machine is 10.10.1.29;本机IP为10.10.1.29; docker container has IP 172.28.0.3; docker 容器的 IP 为 172.28.0.3; and to connect to VM by ssh I putted my creds并通过 ssh 连接到 VM 我把我的信任
I have DockerFile of myApp我有 myApp 的 DockerFile
// some docker commands
EXPOSE 9010
CMD ["java", \
"-Dcom.sun.management.jmxremote", \
"-Dcom.sun.management.jmxremote.authenticate=false", \
"-Dcom.sun.management.jmxremote.ssl=false", \
"-Dcom.sun.management.jmxremote.port=9010", \
"-Dcom.sun.management.jmxremote.rmi.port=9010", \
"-Djava.rmi.server.hostname=10.10.1.29", \
"-jar /app/myApp-1.0.0.jar"]
the container starts and everything is super by docker-compose容器启动,一切都由 docker-compose 完成
config docker-compose.yaml:配置 docker-compose.yaml:
// some yaml config
ports:
- "9010:9010" # JMX
I am running jconsole locally and tried to run this我在本地运行 jconsole 并尝试运行它
service:jmx:rmi:///jndi/rmi://10.10.1.29:9010/jmxrmi
but connection failed但连接失败
I tried different options but unfortunately unsuccessfully我尝试了不同的选择,但不幸的是没有成功
Does anyone have a solution to this?有人对此有解决方案吗? Maybe the configuration is incorrect?也许配置不正确?
You will have to look into several issues here:您将不得不在这里研究几个问题:
Failure on any of these points will simply not give you access.在任何这些点上的失败都不会让您访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.