I am a bit confused around the behaviour of setting up the dashboard for presenting the k6 test results.
I am using docker desktop to manage my containers on windows but the containers themselves run through linux.
So far I have got everything working. I use a docker compose file to pull down the image and map my volumes /scripts and run command. My issue is that the k6 service only runs during the duration of the test. So for me to view the dashboard download the reports I have to quickly fire up a browser and go to localhost:6565 and download the reports before the service stops otherwise I get a ‘can’t find this page’ error.
Is there a way to automatically open a browser which I guess is another command in the docker compose and keep the service alive during the duration of when viewing the dashboard results.
I tried using the ENV variable ‘K6_WEB_DASHBOARD_OPEN’ but no luck and setting the restart command in the compose file to ‘restart unless stopped’ but that just kept repeating the same test because of the command run being set.
my compose file… any advice would be grateful. thanks.
services:
k6:
image: grafana/k6:latest
container_name: k6-load-tester
volumes:
- ./LoadTester.Tests/scripts:/scripts
command: run /scripts/test.js
networks:
- mynetwork
ports:
- "5665:5665"
environment:
- K6_WEB_DASHBOARD=true
- K6_WEB_DASHBOARD_PERIOD=5s
loadtester:
image: ${DOCKER_REGISTRY-}loadtester
container_name: load-tester-api
build:
context: .
dockerfile: LoadTester/Dockerfile
networks:
- mynetwork
ports:
- "50818:50818"
networks:
mynetwork: