Since you can specify the target host on the Locust class I don't see a need to having to specify it _again_ with an environment variable. Could this restriction be removed, or am I missing something?
I agree. The Docker image should not require any environment variables. I'm not sure if it's a good idea to have the shell script that constructs the command line arguments for locust at all.
However there's an easy workaround. Just specify locust [arguments] as the COMMAND for docker run.
Just specify locust [arguments] as the COMMAND for docker run.
But you still need arguments to make it run correctly. Env vars are one quite regular way of doing this.
I think perhaps we should set /usr/local/bin/locust as the ENTRYPOINT and leave CMD unset. This is quite conventional and means the user must pass all required arguments to docker run, e.g:
docker run -p 8089:8089 --volume $PWD/dir/of/locustfile:/mnt/locust locustio/locust --locustfile /mnt/locust/locustfile.py --no-web -c 1000 -r 100
AWS CLI does this for example.
Ah, yes. ENTRYPOINT is what we should use of course :).
Most helpful comment
But you still need arguments to make it run correctly. Env vars are one quite regular way of doing this.
I think perhaps we should set
/usr/local/bin/locustas theENTRYPOINTand leaveCMDunset. This is quite conventional and means the user must pass all required arguments todocker run, e.g:AWS CLI does this for example.