Running in Docker

The official Docker image is at locustio/locust.

Use it like this (assuming that the exists in the current working directory):

docker run -p 8089:8089 -v $PWD:/mnt/locust locustio/locust -f /mnt/locust/

On Windows, this command will sometimes cause errors. Windows users should try using this instead:

docker run -p 8089:8089 --mount type=bind,source=$pwd,target=/mnt/locust locustio/locust -f /mnt/locust/

Docker Compose

Here’s an example Docker Compose file that could be used to start both a master node, and worker nodes:

version: '3'

    image: locustio/locust
     - "8089:8089"
      - ./:/mnt/locust
    command: -f /mnt/locust/ --master -H http://master:8089
    image: locustio/locust
      - ./:/mnt/locust
    command: -f /mnt/locust/ --worker --master-host master

The above compose configuration could be used to start a master node and 4 workers using the following command:

docker-compose up --scale worker=4

Use docker image as a base image

It’s very common to have test scripts that rely on third party python packages. In those cases you can use the official Locust docker image as a base image:

FROM locustio/locust
RUN pip3 install some-python-package

Running a distributed load test on Kubernetes


One of the ways to run Locust on Kubernetes is to use a Helm chart.

There is a good helm chart here:

Note: this Helm chart is a separate project, and not supported by Locust maintainers.

Kubernetes Operator

Another way to run Locust on Kubernetes is to use the Locust Kubernetes Operator.

The Locust Operator is designed to unlock easy, seamless & effortless distributed performance testing in the cloud.

Note: the Locust Kubernetes Operator is a separate project and is not supported by Locust maintainers.