How to enable JMX in a container running in a local, or remote Docker container.
These are the flags that I typically pass:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9000 -Dcom.sun.management.jmxremote.rmi.port=9000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=0.0.0.0
This enables jmx, allows it to be remote, specifies port 9000, and allows it to bind to all the network interfaces. Then, you just need to make sure to expose port 9000 when you start the container, and connect to it with jconsole or Java Visual VM.