命令嵌套在VSTS / TFS中 [英] Command nesting in VSTS/TFS
本文介绍了命令嵌套在VSTS / TFS中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用linux shell和Docker在VSTS上运行以下嵌套命令,因此我可以停止并删除基于jspsample映像的所有容器:
'pre> $ code Docker rm $(docker stop $(docker ps -a -q --filter ancestor = jspsample --format ={{.ID}}))
不幸的是,代理商总是返回以下错误代码:
2017-01-31T12:06:22.0585100Z未知的简写标记:'a'in -a
2017-01-31T12:06:22.0636870Z请参阅'docker stop --help'。
2017-01-31T12:06:22.0827520Z ## [error] / usr / bin / docker failed with return code:125
2017-01-31T12:06 :22.0850140Z ## [error] / usr / bin / docker failed with error:/ usr / bin / docker failed with return code:125
有没有办法运行这个嵌套命令,还是需要运行一个shell脚本?
解决方案
命令行任务不支持命令嵌套。将命令保存为shell脚本并上传到代码库,然后使用Shell脚本任务运行脚本。
I am trying to run the following nested command on VSTS using linux shell and Docker, so I can stop and remove all the containers that are based on the "jspsample" image:
docker rm $(docker stop $(docker ps -a -q --filter ancestor=jspsample --format="{{.ID}}"))
Unfortunately the agent always returns the following error code:
2017-01-31T12:06:22.0585100Z unknown shorthand flag: 'a' in -a
2017-01-31T12:06:22.0636870Z See 'docker stop --help'.
2017-01-31T12:06:22.0827520Z ##[error]/usr/bin/docker failed with return code: 125
2017-01-31T12:06:22.0850140Z ##[error]/usr/bin/docker failed with error: /usr/bin/docker failed with return code: 125
Is there a way to run this nested command, or do I need to run a shell script?
解决方案
"Command Line" task does not support command nesting. Save your command as a shell script and upload to code repository and then use "Shell Script" task to run the script.
这篇关于命令嵌套在VSTS / TFS中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文