How to use --summary-export when using docker image

Hi there,

how do I get the summary export being written properly to my host system?

This is for example executed in my container run --summary-export=/data/summary.json /app/getMaterials.js but in the end I get

ERRO[0022] failed to create summary export file          error="open /data/summary.json: permission denied"

I wasn’t able to find a docker example for this in the docs :frowning:

Hope you can help me :slight_smile:
All the best!

Hi, and welcome to the k6 community! :tada:

You’ll need to mount a volume or a host folder to the k6 container and save the file there. You might also have to modify the privileges on that folder on your host system, as the container runs k6 with user UID 12345 rather than root.

For instance:

$ docker run
    -v /my-results-folder-on-the-host:/results
    loadimpact/k6 \
    run test.js \
    --summary-export=/results/shared.json

Good luck and all the best!

Thanks it worked out :slight_smile: