I'm trying to pass arguments to the underlying command that docker-compose runs, but I'm not sure how to do it.
This is what my non-docker command looked like:
npm run test:watch -- --verbose --match="matching test name"
Which passes --verbose --match="matching test name" to the test runner.
Now I want to run my tests in docker but I can't get this to work:
docker-compose run test-service-name -- --verbose --match="matching test name"
Is this possible or how should I go about this?
docker-compose run will interpret -- --verbose --match="matching test name" as the command and arguments
Usage:
run [options] [-v VOLUME...] [-p PORT...] [-e KEY=VAL...] [-l KEY=VALUE...]
SERVICE [COMMAND] [ARGS...]
You should put the command and all the arguments in the cli
docker-compose run test-service-name npm run test:watch --verbose --match="matching test name"
docker-compose is used to simplify not to complicate things up, for this you can define it permanently in the docker-compose.yml file using command
command: npm run test:watch --verbose --match="matching test name"
source: https://docs.docker.com/compose/compose-file/#command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With