GitLab loadimpact/k6 docker image : unknown command \"sh\" for \"k6\"

Using the docker image https://hub.docker.com/r/loadimpact/k6/.

There are no instructions, but a simple yml file is configured for GitLab.
We are blocked by a message: * level=error msg=“unknown command "sh" for "k6"”*

loadtest:
  stage: performance-test
  image: loadimpact/k6
  only:
      - k6test
  script:
    - pwd
    - k6 run k6-performance/getSites.js
  cache: {}
  tags:
    - DOCKER
    - NOPROXY
    - CLOUD

Capture

same results with script : ‘k6 run ./k6-performance/getSites.js’ .

Since the ENTRYPOINT of k6’s Dockerfile is k6, you’d need to overwrite it in the GitLab CI file to be able to execute the commands you’ve specified in the script list. You can do it like this: Run your CI/CD jobs in Docker containers | GitLab

2 Likes

Pipeline still chokes with same output error.

loadtest:
  stage: performance-test
  image:
    name: loadimpact/k6
    entrypoint: ["k6"]
  only:
      - k6test
  script:
    - k6 run ./k6-performance/getSites.js
  cache: {}
  tags:
    - DOCKER
    - NOPROXY
    - CLOUD

Set entrypoint as empty and that worked!

loadtest:
  stage: performance-test
  image:
    name: loadimpact/k6
    entrypoint: [""]
  only:
      - k6test
  script:
    - k6 run ./k6-performance/getSites.js
  cache: {}
  tags:
    - DOCKER
    - NOPROXY
    - CLOUD
3 Likes