Error when running k6 in docker

Getting following error when running k6 in docker

Error: no “view” mailcap rules found for type “application/x-executable”
/usr/bin/xdg-open: 869: www-browser: not found
/usr/bin/xdg-open: 869: links2: not found
/usr/bin/xdg-open: 869: elinks: not found
/usr/bin/xdg-open: 869: links: not found
/usr/bin/xdg-open: 869: lynx: not found
/usr/bin/xdg-open: 869: w3m: not found
xdg-open: no method available for opening ‘/agent/_work/_tool/docker-stable/19.3.13/x64/docker’

following are my config settings

docker run `
      -i `
      -v "$($ScriptPath):/src" `
      --name $containerName `
      --rm `
      -e BASEURL=$env:BASEURL `
      -e USERNAME=$env:AURORA_USERNAME `
      -e PASSWORD=$env:AURORA_PASSWORD `
      -e K6_INFLUXDB_USERNAME=$env:INFLUX_USERNAME `
      -e K6_INFLUXDB_PASSWORD=$env:INFLUX_PASSWORD `
      -e K6_OUT=$output `
      -e IS_EXTERNAL_GATEWAY=$isExternalGateway `
      loadimpact/k6 `
      run `
      $debugParam `
      /src$relativePath
    $results += $LASTEXITCODE

Hi @hskhan

I would start making sure docker is correctly working in your environment.

Can you run k6’s “getting started” example and check if that works in your environment?

Create a basic script.js

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

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

And run

  • docker run --rm -i grafana/k6 run - <script.js (Mac, Linux)
  • PS C:\> cat script.js | docker run --rm -i grafana/k6 run - if Windows (PowerShell).

Does that work? If it does, can you share the script/s you are runnning? I suspect you might be using an extension that requires a browser. Then you might need to build your own docker image with the requirements.

I hope this helps.

Cheers!

Hi
Thanks for the email, seem like this issue is due to following

https://github.com/microsoft/azure-pipelines-tasks/issues/17352

1 Like

Hi @hskhan

Thanks for getting back. I understand the error was happening when running k6 in MS Azure pipelines, and that the workaround described in DockerInstaller task permission issues on version 0.213.0 · Issue #17352 · microsoft/azure-pipelines-tasks · GitHub worked? And now it’s been fixed?

Let us know if otherwise.

Cheers!

Hi
yes its working fine now , thanks for your help

1 Like