我使用Ubuntu 18.04在Azure中创建了管道。我的要求是使用bash脚本运行docker映像,并为下面的脚本创建了相同的脚本,但是在执行时我收到一条错误消息:“ docker命令不存在,并且docker:无效的引用格式。
test.sh
#!/bin/bash # echo "=== docker Images===" docker images echo "==== Starut running a jmeter/image ====" docker run "justb4/jmeter:latest" echo "==== Finish ===="
错误
Starting: Bash Script scripts/test.sh ============================================================================== Task : Bash Description : Run a Bash script on macOS, Linux, or Windows Version : 3.163.2 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash ============================================================================== Generating script. Formatted command: bash '/home/vsts/work/1/s/scripts/test.sh' 'justb4/jmeter:latest' mainTest.jmx qa-url 30 1 60 15 2 60 1000 ========================== Starting Command Output =========================== /bin/bash --noprofile --norc /home/vsts/work/_temp/5c641c31-4e55-4ab8-be9e-4cf850432bab.sh === docker Images=== docker: 'images ' is not a docker command. See 'docker --help' ==== Starut running a jmeter/image ==== docker: invalid reference format. See 'docker run --help'. ==== Finish ==== Finishing: Bash Script scripts/test.sh
要详细描述,以下是在az管道上创建的任务:-
1. Install a docker
Output of Task1
2. Just for debugging purpose, I added below bash task **with inline commands** to see if docker
命令可以正常工作,没有任何问题。但是在task3中,当我尝试执行脚本使用与失败相同的命令。
任务2的输出
3. Task 3 to execute test.sh script having docker commands
我使用Ubuntu 18.04在Azure中创建了管道。我的要求是使用bash脚本运行docker映像,并为下面的脚本创建了相同的脚本,但执行时收到错误消息“ docker ...
问题出在Windows或DOS风格的行尾,但是在Azure管道中执行时,并没有引发实际错误。后来知道,每行都以回车符和换行符结尾。如果脚本文件以Windows行结尾保存,则Bash将该文件视为