So if I run curl -u admin:password http://10.0.1.195:8161/api/jolokia
inside Docker container I will get this error:
curl: (7) Failed to connect to 10.0.1.195 port 8161: No route to host
But if I run same cURL command outside the container on the host machine I am able to access ActiveMQ host on port 8161.
Also, I am able to run curl http://10.0.2.111:8086/ping
in the same Docker container which refers to InfluxDB host machine.
I have come to conclusion that my issue is related to ActiveMQ because I am able to connect anywhere else.
ActiveMQ is running on a separate EC2 instance with configured security groups, subnet and VPC. Everything is working fine only accessing this host from inside Docker containers is a problem.
jetty.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
...
<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
<property name="host" value="0.0.0.0" />
<property name="port" value="8161" />
</bean>
...
<bean id="Connector" class="org.eclipse.jetty.server.ServerConnector">
<constructor-arg ref="Server" />
<!-- see the jettyPort bean -->
<property name="host" value="#{systemProperties['jetty.host']}" />
<property name="port" value="#{systemProperties['jetty.port']}" />
</bean>
...
</beans>
jolokia-access.xml
<?xml version="1.0" encoding="UTF-8"?>
<restrict>
<remote>
<host>127.0.0.1</host>
<host>localhost</host>
<host>10.0.0.0/16</host>
</remote>
<deny>
<mbean>
<name>com.sun.management:type=DiagnosticCommand</name>
<attribute>*</attribute>
<operation>*</operation>
</mbean>
<mbean>
<name>com.sun.management:type=HotSpotDiagnostic</name>
<attribute>*</attribute>
<operation>*</operation>
</mbean>
</deny>
</restrict>