Running browser tests in docker container is very slow

I have a docker image that is built from grafana/k6:latest-with-browser as the base image. I found this was the only way I could get chromium to actually work, using Ubuntu or Debian base images then adding k6 resulted in the browser not being found.

When I run my test locally the test finishes in 8 seconds but running the same test inside the container takes 2 minutes 11 seconds. Even if I dedicate 4 cpus and 4 gb or memory to the container it still takes 2m11s to complete.

What is the issue? How do I improve this?

Hi @tgerman,

Can you please share the script, docker compose file, and the cmd lines you use to run the test? Are you deleting the docker cache where the image is stored once the test completes? It could be downloading a new image on every test run :thinking:

Best,
Ankur