0

I am trying to trigger Neoload Test through Azure Devops Pipeline, below is what I have tried so far

  1. Added "Docker CLI installer" task to the pipeline
  2. Added command line task with below code
docker run --rm \
     -v "https://sample.azure.com/sample/Team%20-%20NFT/_git/Team%20-%20NFT ":Neoload_POC.nlp \
     -e SCENARIO_NAME=scenario1 \
     -e NEOLOADWEB_TOKEN=1PNvUSm4uzWewmCQwo1S \
     -e TEST_NAME=Neoload_POC \
     -e CONTROLLER_ZONE_ID=lg01.sample.com:7100  \
     -e LG_ZONE_IDS=<lg01.sample.com:7100>:<1>  \

Docker installer successful ran and installed docker, but command line task returning with below error

docker: invalid reference format.
See 'docker run --help'.
'-v' is not recognized as an internal or external command,
operable program or batch file.
'-e' is not recognized as an internal or external command,
operable program or batch file.

Any help is really appreciated

Vishal Chepuri
  • 306
  • 5
  • 26
  • 1
    It looks like it's interpreting each line as a separate command, so I'd just put the whole command on a single line – Hans Kilian Feb 23 '23 at 09:26
  • @HansKilian The command line is not properly formatted in the question and it is displayed incorrectly. Please edit the question and approve the suggested change. – axiac Feb 23 '23 at 09:48
  • 1
    Are you running this on Windows? CMD does not implement backslash as newline escape. – Álvaro González Feb 23 '23 at 10:13
  • @axiac How do you know that OP has '\' at the end of the lines like you've done in your edit? – Hans Kilian Feb 23 '23 at 10:14
  • @HansKilian It was a formatting issue. The backslashes were there in the original post. – Álvaro González Feb 23 '23 at 10:16
  • @HansKilian I didn't edit anything. Somebody else [wrapped the command line in `\`\`\``](https://stackoverflow.com/posts/75542800/revisions) and now we can see how it really looks like. There isn't any change of the command line; previously it was not displayed correctly because the Markdown parser interpreted some characters (`\ `, `<`, `>`) in a special way. – axiac Feb 23 '23 at 10:19
  • I can't go back to check, but I'm pretty sure they weren't there. The error messages OP is getting are also consistent with missing '\'. Like the `-v` error which you don't explain in your answer. – Hans Kilian Feb 23 '23 at 10:19
  • The command line is invalid, anyway. The backslashes could be missing in the original command, I agree. We cannot know unless the OP posts the exact command that they have run. – axiac Feb 23 '23 at 10:22
  • Thanks all, the issue was due to the backslash, I have kept the whole command on single and it worked. – Vishal Chepuri Feb 23 '23 at 10:33
  • 2
    @HansKilian I don't know what did you find but it is not the right thing. I didn't edit the question. Click on the ["edited XX minutes ago"](https://stackoverflow.com/posts/75542800/revisions) link over the editor's information then go to version 1 and click on the ["Source"](https://stackoverflow.com/revisions/a94214b0-9127-4590-a67b-8d816b6a6e68/view-source) link to find out how the question looked like when it was created. The backslashes are there, the Markdown formatting is the problem. – axiac Feb 23 '23 at 10:48
  • @VishalChepuri Either you had spaces after the backslashes and the backslashes escaped the spaces instead of escaping the newlines or the backslashes need to be doubled in your code, if you generate it (and it is stored in a string literal). – axiac Feb 23 '23 at 10:50
  • @HansKilian I have corrected the syntax, however I am facing another issue (docker: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.32/containers/create: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.) – Vishal Chepuri Feb 23 '23 at 13:48
  • @VishalChepuri I recommend that you create a new question with your new issue – Hans Kilian Feb 23 '23 at 13:53

1 Answers1

0

The problem is on the line

-e LG_ZONE_IDS=<lg01.sample.com:7100>:<1>

For the shell, < and > are the redirection symbols. They need to be enclosed in quotes or apostrophes to not be interpreted as redirections.

Because of the last >, the rest of the line is not part of the docker command and this is why docker complains.

That part of the command should read:

-e LG_ZONE_IDS='<lg01.sample.com:7100>:<1>'

or

-e 'LG_ZONE_IDS=<lg01.sample.com:7100>:<1>'

Also, the docker command is not complete. It misses the name of the image to be used to create the container.
I suppose that you didn't paste the entire command line in the question.

axiac
  • 68,258
  • 9
  • 99
  • 134
  • Thanks @axiac there were multiple issue, Backslash, using of "<>" and missing image name. – Vishal Chepuri Feb 23 '23 at 10:35
  • Hmm... you run the command on Windows, using Command Prompt. I think that it expects a different character to signal that the command continues on the next line. Is it `^`? I didn't work on Windows since 2012. – axiac Feb 23 '23 at 11:42
  • I have corrected the syntax, however I am facing another issue (docker: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.32/containers/create: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.) – Vishal Chepuri Feb 23 '23 at 12:18
  • 1
    @axiac CMD uses `^` and PowerShell uses backtick. – Álvaro González Feb 23 '23 at 18:09