Issue while launching k6 via Docker

I am facing the issue while launching k6 via Docker.

Please find below the logs:-

Hi @Sugam !

Welcome to the community forums! :wave:

It seems like it’s not the issue with the k6 or the k6 in docker, as the error says it looks like a syntaxis issue in the script.

I’d recommend checking if it works without k6 (plain javascript).

Hope that answers,

As per my project, I follow below steps to run k6 scenario:-

  1. I execute npm install to get the dependencies.
  2. I execute npm run build so that app.bundle.js is formed
  3. Then I execute k6 script.

I have two scenarios -

  1. When I execute the above steps at my local (windows - where node and k6 are installed) without using Docker - It works
  2. When I execute the above steps at my local (WSL) with Docker - It gives the error
    Please note that I have used below Docker file with multistage build:-

FROM node:16 AS node
ADD ./k6 /usr/app/k6
WORKDIR /usr/app/k6
RUN npm install
RUN npm run build

FROM loadimpact/k6:latest
COPY --from=node /usr/app/k6 /go/src/

I first execute npm install and npm run build in node image, copies the app.bundle.js in k6 container and then executing the k6 script in k6 conatiner.

Do yo think it can be an issue as I generate app.bundle.js in node container and executing it in k6 container?

Hi @Sugam can you tell us what your dependancies are and where does this regex come from?