Cannot run k6 docker image that was built from windows on linux: lanching browser error - no such file or directory

Hi, all

I have developed all the k6 scripts and build the docker image via Dockerfile on on the windows using WSL.

Here is my Dockerfile

FROM grafana/k6:0.55.0

RUN apk update && apk add --no-cache chromium

ENV K6_BROWSER_ENABLED=true

USER k6

COPY config.js /config.js
COPY setup.js /setup.js
COPY metrics.js /metrics.js
COPY script.js /script.js
COPY data.json /data.json

CMD ["run", "/script.js"]

Yes, what I did is copying all script files to the image and trying to build it as image and run the test from it.

When I run the docker image on the windows for testing. It works very well.

However, when I load this docker image on the linux instance (Alibaba Linux 3), it doesn’t work at all, not even start the test but return this error instead:

error building browser on IterStart: launching browser: open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2) at default (file:///[js file name]:xx:xx(x))

Not sure what’s wrong with the browser test on the image, but I hope someone can figure out how to get through from this error.

Thank you.

Hi @paritwai,

I’m sorry, but I don’t have access to Alibaba Cloud, so I cannot easily try to reproduce the issue you’re experiencing. To go further, I’d even probably say that this isn’t a kind of support we officially offer.

However, by having a quick look at your Dockerfile, I spotted that you’re using the standard image as base image: grafana/k6:0.55.0, but if you plan to run Browser tests from within the image, I suspect you should be using the *-with-browser image as base, as stated in docs.

So, my very first recommendation to follow up on this topic and try to solve your issues would be to replace FROM grafana/k6:0.55.0 with FROM grafana/k6:0.55.2-with-browser and try again. Note that I also took the opportunity to update to the latest v0.55.x patch version, but that’s a minor detail.

You can find that tag here.

I hope that helps! :crossed_fingers:

1 Like

Thanks for the reply!

I have changed to run the script by installing k6 and the chromium on the OS instead of running it on the container, and it works like a charm.

At first, I though about to run multiple tests at the same time, that’s why I decided to run it on the container, but due to the lack of resources, running the test one by one is probably the best solution, so I don’t need to run on the container anymore.

1 Like

Hey @paritwai,

Glad to know that you manage to solve the problem in either way! :bowing_man:

Cheers!