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

#1

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

Gitlab pipeline: "k6bin/k6 not found"
#2

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

#3

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: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#overriding-the-entrypoint-of-an-image

1 Like
#4

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
#5

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
1 Like