[英]How do I pass command line arguments to docker-compose run?
I'm trying to pass arguments to the underlying command that docker-compose runs, but I'm not sure how to do it. 我正在尝试将参数传递给docker-compose运行的基础命令,但是我不确定该怎么做。
This is what my non-docker command looked like: 这是我的非docker命令的样子:
npm run test:watch -- --verbose --match="matching test name"
Which passes --verbose --match="matching test name"
to the test runner. --verbose --match="matching test name"
传递给测试运行程序。
Now I want to run my tests in docker but I can't get this to work: 现在我想在docker中运行测试,但无法正常工作:
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 -- --verbose --match="matching test name"
docker-compose run
将-- --verbose --match="matching test name"
为命令和参数
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 您应该将命令和所有参数放在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 docker-compose用于简化不使事情复杂化,为此,您可以使用以下命令在
docker-compose.yml
文件中永久定义它
command: npm run test:watch --verbose --match="matching test name"
source: https://docs.docker.com/compose/compose-file/#command 来源: https : //docs.docker.com/compose/compose-file/#command
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.