Issue with K6 docker image not starting

Hi All,

I have docker desktop installed on my windows laptop and I executed command
docker pull grafana/k6 but somehow docker image is not starting.

Hi @bharati023,
do you can send a image or part of the error?
Maybe you test using another version the K6, example:

docker pull grafana/k6:latest
docker pull grafana/k6:0.55.0

Hi, I tried above commands but still the same issue.
Just wondering, is this the case image will be in exiting mode until we execute any test.

Hi,

do we need to set any path/variable?

Thank you

Hi @bharati023

Yes, we need to set the commands to use K6. In the image maybe you need to use de Command line interface (bash, cmd or powershell).

After the execution docker pull grafana/k6:0.55.0 you execute the command docker run -i grafana/k6:0.55.0 run - <test.js, in this format works for me.

Another way is execute the command docker run --rm -v $(pwd):/scripts -w /scripts grafana/k6:0.55.0 run /scripts/test.js being that /scripts this is your directory with the code

I’m here to help, let me know if it worked

Thank you so much for quick help. it worked. Have a nice day !

docker run -i grafana/k6:0.55.0 run - <firstTest.js
failed to get console mode for stdin: The handle is invalid.

     /\      Grafana   /‾‾/  
/\  /  \     |\  __   /  /   

/ / \ | |/ / / ‾‾\
/ \ | ( | (‾) |
/ __________ \ ||_\ ____/

 execution: local
    script: -
    output: -

 scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
          * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

running (00m01.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
default [ 0% ] 1 VUs 00m01.0s/10m0s 0/1 iters, 1 per VU

 data_received..................: 17 kB 14 kB/s
 data_sent......................: 546 B 429 B/s
 http_req_blocked...............: avg=279.03ms min=127.04ms med=279.03ms max=431.02ms p(90)=400.63ms p(95)=415.82ms
 http_req_connecting............: avg=4.74ms   min=3.37ms   med=4.74ms   max=6.1ms    p(90)=5.83ms   p(95)=5.97ms
 http_req_duration..............: avg=355.04ms min=256.82ms med=355.04ms max=453.27ms p(90)=433.63ms p(95)=443.45ms
   { expected_response:true }...: avg=355.04ms min=256.82ms med=355.04ms max=453.27ms p(90)=433.63ms p(95)=443.45ms
 http_req_failed................: 0.00% 0 out of 2
 http_req_receiving.............: avg=199.08µs min=185.19µs med=199.08µs max=212.96µs p(90)=210.18µs p(95)=211.57µs
 http_req_sending...............: avg=56.79µs  min=30.28µs  med=56.79µs  max=83.3µs   p(90)=77.99µs  p(95)=80.65µs
 http_req_tls_handshaking.......: avg=212.42ms min=0s       med=212.42ms max=424.84ms p(90)=382.35ms p(95)=403.59ms
 http_req_waiting...............: avg=354.79ms min=256.6ms  med=354.79ms max=452.97ms p(90)=433.34ms p(95)=443.16ms
 http_reqs......................: 2     1.569723/s
 iteration_duration.............: avg=1.27s    min=1.27s    med=1.27s    max=1.27s    p(90)=1.27s    p(95)=1.27s
 iterations.....................: 1     0.784861/s
 vus............................: 1     min=1      max=1
 vus_max........................: 1     min=1      max=1

running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [ 100% ] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU

1 Like

That’s great that it worked! Have a nice day! :handshake:

Hi Again,

Just wondering again, why result is showing http_reqs…: 2 1.569723/s because I am checking for single user only.

hi @bharati023

Do you can send a image of the summary metrics?

Hi,
I installed another image as well (v0.54.0) but same issue exist.

Steps for installation: Open command prompt, and execute docker pull grafana/k6:0.54.0

Basic script - import http from ‘k6/http’;
import {sleep} from ‘k6’;
export default function () {
http.get(‘http://test.k6.io’);

sleep(1);

}

Command to execute my script- docker run -i grafana/k6:0.54.0 run - <script.js
Note : I am using IntelliJ as editor.


issues : I see 2 http requests instead of 1.
also my script name is not available in logs. I have attached screenshot for referance

Hi @bharati023

I understand your question, but isn’t a issue. In K6 when isn’t have options in script, the actions of the K6 is “wait” the request and response of the API. If your API performance in a default timeout, the request is sending. For you control the iteration you have use iterations as example below:

In the example I use Options in k6

import http from 'k6/http';
import { sleep } from 'k6';

export const options = {
    vus: 1,
    iterations: 1,
};

export default function () {
    http.get('http://test.k6.io');
    sleep(1)
}

does that mean this is expected behavior ? I have shared the screenshot again.

really @bharati023 even running locally gives this issue. Maybe this issue is recentend in version 0.55. Try to run in change version in k6 docker, or create a issue in Github K6.

Thank you for quick help. sure I will do that. Have a nice day !

1 Like