How to run JMX monitoring in Docker image?
It’s sometimes useful to quickly connect to JMX console, to checkout what’s going on in your application, but the whole thing get’s tricky if you’re running your app in a container. I need it from time to time and I keep myself few times searching for set of params below: ~/2021/02/how-to-run-jmx-monitoring-in-docker-image/ java \ ... -Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.rmi.port=${PORT1} \ -Dcom.sun.management.jmxremote.port=${PORT1} \ -Dcom.sun.management.jmxremote.local.only=false \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ -Djava.rmi.server.hostname=${HOST} The whole magic here is that PORT1 in container is app’s second port....