0

I have limited knowledge of docker. But this is what I have done. I installed docker desktop. Pulled images for influxdb 1.8 and grafana and loadimpact/k6. Created containers for influxdb and grafana which are running fine.

http://localhost:3000/ -> working http://localhost:8086/ -> gives 404 page not found

I want to run my k6 script in the docker, save result in the influxdb and then use grafana to create custom dashboards based on data in influxdb.

When I give the following command from the command prompt from the folder in which K6 script is present:

docker run -v /k6 -i loadimpact/k6 run --out influxdb=http://localhost:8086/myk6db - <K6-script.js

I get the following error.

time="2021-10-16T10:09:58Z" level=error msg="The moduleSpecifier \"./libs/shim/core.js\" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker.\n\tat reflect.methodValueCall (native)\n\tat file:///-:205:34(24)\n" hint="script exception"

The folder is which K6-script.js is present, two more folders are present K6 and libs which are imported in the K6-script.js .

Then I referred [https://k6.io/docs/using-k6/modules/#local-filesystem-modules][1] and gave the following command

docker run -v //c/loadtesting:/src -i loadimpact/k6 run --out influxdb=http://localhost:8086/myk6db K6-script.js

which gives me the following error.

level=error msg="The moduleSpecifier \"K6-script.js\" couldn't be found on local disk. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://k6.io/docs/using-k6/modules#using-local-modules-with-docker. Additionally it was tried to be loaded as remote module by prepending \"https://\" to it, which also didn't work. Remote resolution error: \"Get \"https://K6-script.js\": dial tcp: lookup K6-script.js on 192.168.65.5:53: no such host\""

How do I resolve this error and run K6 script in the docker using influxdb?

Jay
  • 339
  • 1
  • 7
  • 23

1 Answers1

0

after much trial and error when I gave following command , the test ran. It couldn't connect to to InfluxDB database but that is another issue I need to resolve . But otherwise the test ran.

docker run -v //c/loadtesting:/src -i loadimpact/k6 run --out influxdb=http://localhost:8086/myk6db /src/K6-script.js

I think it needed the path of script which is inside the container to run the script.

Jay
  • 339
  • 1
  • 7
  • 23