Hi @BobRuub!
Let me try to help you!
Yes, considering the docker -run v
is the right direction.
let’s say you have a directory that contains some files:
tree
.
├── config.json
├── data
│ └── users.json
└── http_get.js
Here the config.json is k6’s config file. The users.json
is just some data file that I will use in the tests. And the http_get.js is the test script.
If I run the command:
docker run --rm -v $(pwd):/scripts loadimpact/k6:latest run /scripts/http_get.js
It will mount the current directory (what the pwd
returns) as the /scripts
inside the container. And execute the following command inside the container.
k6 run /scripts/http_get.js
My http_get.js can use any resource located in the same directory. Just use a relative path, like:
const f = open('data/users.json');
If I want to use the config.json to run my k6, it will look like this:
docker run --rm -v $(pwd):/scripts loadimpact/k6:latest run --config /scripts/config.json /scripts/http_get.js
Let me know if that helps!
Cheers