Reputation: 1037
I am trying to distribute loading tests using Docker containers.
At local in JMeter, my tests run correctly in GUI or non GUI mode, but when I try to run any of them in non GUI mode using a docker image for JMeter:
docker run egaillardon/jmeter -n -t ~/Developer/testing/login_test.jmx -l ~/Desktop/resultado.jtl
I get the error:
Could not open ~/Developer/testing/login_test.jmx
I tried with different docker images for JMeter (egaillardon/jmeter, justb4/jmeter, vmarrazzo/jmeter)
and I got the same error in any of them. Anyone knows what I have to change in my jmx file to do it readable?
I already tried with this solution in Stack Exchange but none worked for me.
Upvotes: 3
Views: 4217
Reputation: 31
You can also mount the host directory to the default working directory (/jmeter
) in the container.
Example :
docker run --detach --rm --volume `pwd`:/jmeter egaillardon/jmeter-plugins --nongui --testfile test.jmx --logfile result.jtl
By doing so, the jmeter run log file (jmeter.log
) will also be created in the host directory.
In addition, to address issue regarding file permissions, you can also assign the user id and the group id of the user on the host to the jmeter user inside the container.
Example :
docker run --env JMETER_GROUP_ID=`/usr/bin/id -g` --env JMETER_USER_ID=`/usr/bin/id -u` --rm egaillardon/jmeter --server -Jserver.rmi.ssl.disable=true
Upvotes: 3
Reputation: 104095
~/Developer/testing/login_test.jmx
would be loaded from the container filesystem perpective, chances are that this path does not exist within your container filesystem.
To overcome this, you could mount this file from your host filesystem into your container filesystem with a docker volume:
docker run -v ~/Developer/testing/:/workspace egaillardon/jmeter -n -t /workspace/login_test.jmx -l /workspace/resultado.jtl
-v ~/Developer/testing/:/workspace
: mount the ~/Developer/testing/
directory from your host to the path /workspace/
in the container filesystem-n -t /workspace/login_test.jmx -l /workspace/resultado.jtl
: options passed to the container processus (jmeter) at runtime, and thus in the context of the container. We need to adjust paths so that they match the location we chose when configuring the volume.Upvotes: 3