Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to profile java app inside docker container on remote host protected by firewall
  1. Restart the app with the following JVM arguments:
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.rmi.port=9010
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
  1. Expose port 9010 for that docker container.

  2. Bring up an SSH tunnel to the host, which runs that docker container, to forward all communications through port 9010:

ssh vpn -L 9010:localhost:9010
  1. Start jvisualvm and add new "JMX connection" to "localhost:9010"
  2. "Profile" tab will not be available, because of JMX. But, "Sampling" tab is useful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment