Running Locust with Docker

To keep things simple we provide a single Docker image that can run standalone, as a master, or as a slave.

Environment Variables


One of ‘standalone’, ‘master’, or ‘slave’. Defaults to ‘standalone’.


The path inside the container to the locustfile. Defaults to ‘/`


The hostname of the master.


The port used to communicate with the master. Defaults to 5557.

Add your tests

The easiest way to get your tests running is to build an image with your test file built in. Once you’ve written your locustfile you can bake it into a Docker image with a simple Dockerfile:

` FROM locustio/locust ADD `

You’ll need to push the built image to a Docker repository such as Dockerhub, AWS ECR, or GCR in order for distributed infrastructure to be able to pull the image. See your chosen repository’s documentation on how to authenticate with the repository to pull the image.