VisualVM连接到托pipe在Docker上的Tomcat

我试图configuration一个从VisualVM到托pipe在远程Docker机器上的Tomcat的JMX连接:

locahost with VisualVM --> server with docker (192.168.23.8) --> Tomcat container 

我的Dockerfile是:

 FROM centos:centos6 RUN yum upgrade -y \ && yum -y install java-1.7.0-openjdk \ && yum -y install tar \ && yum clean all COPY apache-tomcat-7.0.64.tar.gz /tmp/ RUN mkdir /opt/tomcat RUN tar -xzvf /tmp/apache-tomcat-7.0.64.tar.gz --directory /opt/tomcat/ --strip 1 RUN rm /tmp/apache-tomcat-7.0.64.tar.gz COPY catalina-jmx-remote.jar /opt/tomcat/lib/ COPY setenv.sh /opt/tomcat/bin/ COPY server.xml /opt/tomcat/conf/ EXPOSE 8080 EXPOSE 9090 EXPOSE 9091 CMD /opt/tomcat/bin/catalina.sh start && tail -f /opt/tomcat/logs/catalina.out 

用bin / setenv.sh文件(其中192.168.23.8是我的主机IP):

 export JAVA_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.23.8" 

用原来的conf / server.xml添加了以下监听器:

 <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="9090" rmiServerPortPlatform="9091" /> 

catalina-jmx-remote.jar已经在7.0.64 extras库中find了。

每个端口在localhost和docker服务器之间打开,我的端口正确显示:

 Ports: [ { IP: "0.0.0.0", PrivatePort: 9091, PublicPort: 9091, Type: "tcp" }, { IP: "0.0.0.0", PrivatePort: 9090, PublicPort: 9090, Type: "tcp" }, { IP: "0.0.0.0", PrivatePort: 8080, PublicPort: 33284, Type: "tcp" } ] 

而Tomcat日志是:

 INFO: Command line argument: -Dcom.sun.management.jmxremote=true Oct 26, 2015 8:36:52 AM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcom.sun.management.jmxremote.ssl=false Oct 26, 2015 8:36:52 AM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcom.sun.management.jmxremote.authenticate=false Oct 26, 2015 8:36:52 AM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Djava.rmi.server.hostname=192.168.23.8 ... Oct 26, 2015 8:36:53 AM org.apache.catalina.mbeans.JmxRemoteLifecycleListener createServer INFO: The JMX Remote Listener has configured the registry on port 9090 and the server on port 9091 for the Platform server 

但是当我在VisualVM上打开一个新的JMX连接时,出现以下错误:

 Cannot connect to 192.168.23.8:9090 using service:jmx:rmi:///jndi/rmi://192.168.23.8:9090/jmxrmi 

任何想法来解决这个问题?