How to access JMX (Java Beans) from a process running in docker container

Why is it so hard to connect to a JMX port (using JConsole), when a process is run using Docker.

Of course I have exposed the JMX port to the host, and even used Sun specific options while running the Java process (following the instructions from ).

  • Access docker containers from local network via dev suffix
  • /bin/sh: 1: composer: not found
  • CircleCI : configuring the test of Docker container hosted on gcp
  • Attack vectors when running untrusted docker images
  • Docker pull not getting image tagnames
  • Docker instruction in Java Maven project to skip tests
  • I am able to telnet to the host ip and the exposed JMX port, which tells that it is accessible. But I can’t figure out a way to use JConsole and connect to the JMX service running in the container.


  • How to develop Erlang Nitrogen apps in Docker
  • How to use multiple base images to build a docker image
  • Why is it not possible to call locale-gen with sudo inside a docker container?
  • Is LXD is used in production?
  • Can't connect to a docker container port where an app is listening
  • How to tell docker worker node belong to which swarm?
  • 3 Solutions collect form web for “How to access JMX (Java Beans) from a process running in docker container”

    In the past, the two ports had to be different. Please try that for a start.

    If thats not working:

    Tomcat offers an additional component to set the second port mentioned, the JMX Remote Lifecycle Listener.

    Please have a look at:

    I´m using this setting with catalina-jmx-remote.jar in my tomcat/lib directory to get through: 

    Plus these, but you wouldn´t need them in a dev environment.

    What you currently have looks correct. To at least try and get it working, i’d try disabling auth & ssl. Then, once you get it working, think about re-enabling any security you require:

    Indeed, you need those 2 ports to be different. One port is for the RMI registry and the other for the remoting protocol.

    When specifying the URL to connect to the server from jconsole/visualvm use the port set in “” on the server side.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.