'Why is this ENTRYPOINT incorrect?

My DockerFile has an ENTRYPOINT that just echoes ENTRYPOINT echo %windir%\system32\inetsrv\appcmd to the command window.

  • This syntax works: ENTRYPOINT echo %windir%\system32\inetsrv\appcmd
  • This doesn't: ENTRYPOINT ["echo", "%windir%\system32\inetsrv\appcmd"]

The output is '[\"echo\"' is not recognized as an internal or external command, operable program or batch file.

What's the different between these two syntaxes?



Solution 1:[1]

The answer was in the documentation (who'd have thought that?)

The first form executes in a shell, and is therefore equivalent to anything you might type into it.

The second form doesn't execute in a shell, it just executes the file with the provided arguments.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BanksySan