1

We are experimenting with loadimpact - k6 docker image and we wanted to run task for the longer period of time.

The issue which we were facing is the container is exited if the ssh connection is timing out.

Command:

docker run -i loadimpact/k6 run --vus 250 --duration 60m - <script.js

Also, if we don't pass -i or use -d it doesnt work.

We want it to execute in background and it should work even if ssh will time out.

mohit
  • 191
  • 1
  • 9

2 Answers2

1

You have to create a new Docker image that will only run your code. I would suggest you read the Docker documents once,all you have to do is create a new Docker image that will only run your application.

i think this Dockerfile will work:

vi Dockerfile

FROM loadimpact/k6
COPY script.js /script.js
CMD ["run", "script.js","--vus","250","--duration","60m"]

copy your own script and Dockerfile into a folder and then run the following command:(It could be wrong because I don't have the files, and I haven't been able to test.)

docker build -t yourdesirename .

it will create a new docker image with name you enternd and latest tag now you can run it in background

docker run -d yourdesirename:latest
user634
  • 3
  • 2
1

This actually helps me.

Dockerfile:

FROM loadimpact/k6
COPY script.js /

Build Command:

docker build -t load-testing -f Dockerfile .

Run Command:

docker run -d load-testing run --vus 250 --duration 60m script.js
mohit
  • 191
  • 1
  • 9