This is how I am running and getting to stdout per docs:
docker run -i loadimpact/k6 run --vus 10 --iterations 1 - <script.js
How do I save to a json file?
This is how I am running and getting to stdout per docs:
docker run -i loadimpact/k6 run --vus 10 --iterations 1 - <script.js
How do I save to a json file?
Hi @computerchris,
there are several ways of accomplishing this, but they’re mostly in Docker’s domain and not related to k6.
If you need to get files out of the container the easiest way in this case would be to mount a local directory as a Docker volume.
For example, assuming script.js
is in the current working directory:
docker run --rm -i -v "$PWD:/work" loadimpact/k6 run --vus 10 --duration 5s --out json=/work/out.json /work/script.js
This would write to “$PWD/out.json” on the host filesystem, though note that the file will probably be owned by root
, unless you ran the container with a different user or have user namespace remapping enabled in Docker.
See some of the details mentioned in the documentation.
Thank you so much, I’ll look into that.