Insights: Running k6 in Docker on Windows

When running k6 from a Docker container on Windows through PowerShell you have to use a different command than the one we instruct users to use on Mac or Linux based systems. You can’t read the script from stdin but will instead have to resort to using Docker volumes:

docker run -i -v //c/Users/k6:/k6 -e K6CLOUD_TOKEN=<your token> loadimpact/k6 run --vus 100 --duration 300s -o cloud /k6/script.js

In the example above the k6 script is located in C:\Users\k6 at C:\Users\k6\script.js, that folder is then mounted as a volume into the k6 Docker container at mount point /k6 which is why the path to the script inside the running container becomes /k6/script.js

You also need to make sure that your drive in question, in the example above C:\, has been marked for sharing in the Docker settings:


Feedback and Knowledge Base