JMeter - docker - java.net.connectexception
<p>I am trying to do a distributed load testing using JMeter in AWS EC2 instances.</p>

<p>I have 1 master and 2 slaves. All are ubuntu instances.
They all have java and jmeter installed.</p>

<p>I am able to successfully execute the test in the slaves w/o issues. (When i do no use docker) (JMeter uses RMI to control slaves)</p>

<p>Now, I am thinking of using docker in the slaves as I might be adding more slaves. I do not want to set up the slave machines everytime. So docker seems to be a good choice.</p>

<p>In the docker container, everything seems to be correct, all the necessary ports are open.</p>

<p>Issue:</p>

<p>Whenever I use docker container to run the jmeter-server in the slave, if i try to connect to it from the master, It throws <code>java.net.connectexception connection refused connect &lt;ip address&gt;</code> error.</p>

<p>If I telnet from the master to slave, it is able to connect successfully.</p>

<p>My dockerfile:</p>

<pre><code>FROM ubuntu
RUN apt-get update
RUN apt-get -y install wget
RUN apt-get -y install default-jre
RUN mkdir /jmeter
RUN cd /jmeter/ ; wget http://www.us.apache.org/dist//jmeter/binaries/apache-jmeter-2.13.tgz ; tar -xzf apache-jmeter-2.13.tgz ; rm apache-jmeter-2.13.tgz
ENV JMETER_HOME /jmeter/apache-jmeter-2.13/
ENV PATH $JMETER_HOME/bin:$PATH
EXPOSE 1099 7000 50000
ENTRYPOINT $JMETER_HOME/bin/jmeter-server -Djava.rmi.server.hostname=$LOCALIP 
</code></pre>

<hr>

<p>This is how i create a container</p>

<pre><code>sudo docker run -dit -e LOCALIP='10.11.12.13' -p 7000:7000 -p 1099:1099 -p 50000:50000 "mydockerimg" /bin/bash
</code></pre>

<p>I do not understand what is happening here!! How should i fix this?</p>

<hr>

<p>UPDATE: Tried as per @arcticless suggestion</p>

<p><a href="https://i.stack.imgur.com/EfWx1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EfWx1.png" alt="enter image description here"></a></p>