Docker Extensions was announced as a beta at DockerCon 2022. Docker Extensions became generally available in January 2023. Developing performance tools' related extensions was on my to-do list for a long time. Due to my master's degree I couldn't spend time learning Docker Extensions SDK. I expected someone would have created the extension by now, considering it's almost 2024. It's surprising to me that none has been developed as far as I know. But no more. Introducing the Apache JMeter Docker Extension. Now you can run Apache JMeter tests in Docker Desktop without installing JMeter locally. In this blog post, we will explore how to get started with this extension and understand its functionality. We will also cover generating HTML reports and other related topics.
About Docker Extensions
Docker Extensions enables third parties to extend the functionalities of Docker by integrating their tools. Think of it like a mobile app store, but for Docker.
I frequently use the official Docker Disk Usage extension to analyze disk usage and free up unused space.
Extensions enhance the productivity and workflow of developers. Check out the Docker Extension marketplace for some truly amazing extensions. Go see it for yourself!
Prerequisite for Docker Extension
The only prerequisite for Docker Extension is to have Docker Desktop 4.8.0 and later installed in your local.
Apache JMeter Docker Extension
Apache JMeter Docker Extension is an open source, lightweight extension and the only extension is available as of this writing. It will help you to run JMeter tests on Docker without installing JMeter locally.
This extension simplifies the process of setting up and executing JMeter tests within Docker containers, streamlining your performance testing workflow. Whether you're a seasoned JMeter pro or just getting started, this tool can help you save time and resources.
Features
- Includes base image qainsights/jmeter:latest by default.
- Light-weight and secured container
- Supports JMeter plugins
- Mount volume for easy management
- Supports property files
- Supports proxy configuration
- Generates logs and results
- Intuitive HTML report
- Displays runtime console logs
- Timely notifications
How to install Apache JMeter Docker extension?
Installation is a breeze. There are two ways you can install the extension.
Command Line
Run docker extension install qainsights/jmeter-docker-extension:0.0.1
in your terminal and follow the prompts.
$> docker extension install qainsights/jmeter-docker-extension:0.0.1
Extensions can install binaries, invoke commands, access files on your machine and connect to remote URLs.
Are you sure you want to continue? [y/N] y
Image not available locally, pulling qainsights/jmeter-docker-extension:0.0.1...
Extracting metadata and files for the extension "qainsights/jmeter-docker-extension:0.0.1"
Installing service in Desktop VM...
Setting additional compose attributes
Installing Desktop extension UI for tab "JMeter"...
Extension UI tab "JMeter" added.
Starting service in Desktop VM......
Service in Desktop VM started
Extension "JMeter" installed successfully
Web
Here is the direct link to install the JMeter extension. Follow the prompts to get it installed.
Install JMeter Docker Extension
Click on Install anyway to install the extension.
How to get started with JMeter Docker Extension?
After installing the JMeter Docker extension, navigate to the left sidebar as shown below, then click on JMeter.
Now it is time to execute our first tests on Docker using JMeter extension.
The following are the prerequisites to execute the JMeter tests.
- valid JMeter test plan
- optional proxy credentials
- optional JMeter properties file
The user interface is pretty simple, intuitive, and self-explanatory. All it has is text fields, buttons, and the output console log.
The extension has the following sections:
- Image and Volume
- This extension works well with the
qainsights/jmeter:latest
image - Other images might not work; I have not tested it.
- Mapping the volume from the host to the Docker container is crucial to share the test plan, CSV test data, other dependencies, property files, results, and other files.
- Test Plan
- A valid test plan must be kept inside the shared volume.
- Property Files
- This section helps you to pass the runtime parameters to the JMeter test plan.
- Logs and Results
- This section helps you to configure the logs and results. After each successful test, logs and an HTML report will be generated and saved in a shared volume.
- Proxy and its credentials
- Optionally you can send a proxy and its credentials. This is helpful when you are on the corporate network so that the container can access the application being tested.
Below is the example test where the local volume /Users/naveenkumar/Tools/apache-jmeter-5.6.2/bin/jmeter-tests
is mapped to the container volume jmeter-tests
.
Here is the content in /Users/naveenkumar/Tools/apache-jmeter-5.6.2/bin/jmeter-tests
folder in my local.
Above artifacts will be shared with the Docker container once it is up and running.
In the above example, /jmeter-tests/CSVSample.jmx
will be executed inside the container. It will use the below loadtest.properties
.
Once all the values are configured, hit the Run JMeter Test
button.
During the test you can pay attention to a couple of sections. One is console logs. For each test, the runtime logs will be streamed from the Docker container as shown below.
In case there are any errors, you can check them under Notifications section.
Once the test is done, Notifications will display the status and the location of HTML report (your mapped volume).
Here is the auto-generated HTML report.
How JMeter Docker Extension works and its architecture?
On a high level, how this extension is simple as shown in the below diagram. Once you click on the Run button, the extension first validates all the input and the required fields.
If the validation check passes, then the extension will look up the artifacts from the mapped volume. Then it passes all respective JMeter arguments to the image qainsights/jmeter:latest
.
If the image is not present, it will get pulled from the Docker container registry.
Then the container will be created up by Docker and perform the test execution.
During the test execution, container logs will be streamed to the output console logs.
To stop the test, click the Terminate button to nuke the container. This action is irreversible and will not generate any test results.
Once the test is done, HTML report and the logs will be shared with the mapped volume.
How to uninstall the extension?
There are two ways to uninstall the extension. Using the CLI, issue docker extension uninstall qainsights/jmeter-docker-extension:0.0.1
or from the Docker Desktop.
Navigate to Docker Desktop > Extensions > JMeter, then click on the menu to uninstall as shown below.
Known Issues
There are a couple of issues (or more :) if you find) you can start the test as much as you want to generate more load to the target under test.
Supports only frequently used JMeter arguments. If you would like to add more arguments, please raise an issue in the GitHub repo.
Upcoming Features
There are a couple of features I am planning to implement based on the reception.
- Add a dashboard to track the tests
- Display graphs/charts runtime
- Way to add JMeter plugins on the fly
If you have any other exciting ideas, please let me know.
JMeter Docker Extension GitHub Repo
Conclusion
In conclusion, the introduction of the Apache JMeter Docker Extension is a significant step forward for developers and testers looking to streamline their performance testing workflow. With this open-source and lightweight extension, you can run JMeter tests in Docker without the need to install JMeter locally, saving you time and resources.
Despite a few known issues and limitations, such as supporting only frequently used JMeter arguments, the extension holds promise for the future.
In summary, the Apache JMeter Docker Extension provides a valuable tool for developers and testers, enabling them to perform JMeter tests efficiently within Docker containers, and it's a welcome addition to the Docker Extension ecosystem. It's worth exploring for anyone involved in performance testing and looking to simplify their workflow.