1.下载jmeter
wget http://mirrors.tuna.tsinghua.edu.cn/apache//jmeter/binaries/apache-jmeter-5.1.1.tgz
2. vim Dockerfile
FROM java:8
ENV http_proxy ""
ENV https_proxy ""
RUN mkdir /jmeterdocker
RUN mkdir -p /jmeterdocker/test
RUN mkdir -p /jmeterdocker/test/input/jmx
RUN mkdir -p /jmeterdocker/test/input/testdata
RUN mkdir -p /jmeterdocker/test/report/html
RUN mkdir -p /jmeterdocker/test/report/jtl
RUN mkdir -p /jmeterdocker/test/report/outputdata
RUN cd /jmeterdocker
ENV JMETER_VERSION=5.1.1
ENV JMETER_HOME=/jmeterdocker/apache-jmeter-${JMETER_VERSION}
ENV JMETER_PATH=${JMETER_HOME}/bin:${PATH}
ENV PATH=${JMETER_HOME}/bin:${PATH}
COPY apache-jmeter-${JMETER_VERSION}.tgz /jmeterdocker
RUN cd /jmeterdocker
&& tar xvf apache-jmeter-5.1.1.tgz
&& rm apache-jmeter-5.1.1.tgz
3.运行
docker run --name="jmeter1" --net="host" -v /tmp/jmeterspace/test/input/jmx:/jmeterdocker/test/input/jmx
-v /tmp/jmeterspace/test/input/testdata:/jmeterdocker/test/input/testdata
-v /tmp/jmeterspace/test/report/html:/jmeterdocker/test/report/html
-v /tmp/jmeterspace/test/report/jtl:/jmeterdocker/test/report/jtl
-v /tmp/jmeterspace/test/report/outputputdata:/jmeterdocker/test/report/outputdata
-it -d dufebin/jmeter:v1