K6 using docker in azure pipeline

I am trying to run K6 tests in azure pipeline using docker commands. K6 tests runs fine without --out option:
$ docker run -it --rm
-v :/scripts
-v :/jsonoutput
loadimpact/k6 run --out json=/jsonoutput/my_test_result.json /scripts/script.js

When I give --out option to generate output json file it gives me error as “permission denied”. All directories paths are valid.
Please guide if we need any specific permission while creating output file while running through pipeline.

Hi @MVB,
It looks like an issue with the volume mount and/or mismatch of user rather than k6 itself. Please note how k6 image is run:

I think it makes sense to check permissions set on /jsonoutput/ folder with this in mind.

Thanks for the response.
This problem has been solved by granting chmod 777 to the report file. Now it is generating report. But the generated json file is not valid. It is giving error as Data at root level is invalid. Any help on this one?

Hm, k6 output works without such error with local Docker setup for me and looking here, it sounds as an exception generated by Azure VM? Can you see a full stack for this exception in logs / console / etc? That should help to diagnose what exactly causes it.