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