Skip to main content

Docker Image for JMeter with Plugin Manager

Docker image is used to create container which could be run using Docker, Kubernetes.

I have used Alpine image as base image on which JMeter is downloaded and Plugin manager is installed, sample file Github

In docker folder you would two files that are required to create JMeter docker container.

  • Dockerfile: This is used to create docker image
  • This file is executed on start of container


In this file you can configure JMeter version, timezone any other utilities that you want to have in the container.
Below are the variables that determines the JMeter version and timezone for the container


In this file you can configure the properties and plugins that are required to be installed.
Below show the sample on adding properties, all the properties will be added to which will override file.

#add properties
echo server.rmi.ssl.disable=true >> /opt/apache-jmeter-5.3/bin/

To install any plugins using PluginManager, plugin name has to be appended to the existing. Plugin name can be obtained from JMeter Plugins website.
I have configure Dummy Sampler and Custom Thread Groups to be installed on Container start, you can add more as pre requirement. install jpgc-casutg,jpgc-dummy

We determine if JMeter should be running in Master mode (supervisor for other slave nodes) or Slave node.
Below code will decide on how JMeter needs to be started, and "mode" variable can be configured using environment variables for container.

if [ "$mode" == "master" ]; then
  jmeter $@
  jmeter-server >>  /mnt/jmeter/logs/$mode-jmeter-server_`date '+%Y-%m-%d_%H-%M-%S'`.log

Build and push image to repository

To build Docker image, run the below command from the Folder which has both files

docker build -t jmeter .

Once the image is built, you can you view existing images using the below command

docker images

Next we need to tag the jmeter image with the name of repository and push, if you are using Docker hub as registry even though you don't have a existing repository a new one will be created on push.

docker tag <image-id> <repository-name>
docker push <repository-name>

Below image shows jmeter image after build which I tagged with my jmeter reporsitory in github and pushed it to Docker hub 

Once image is pushed to repository we can use it.